File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class Form extends Nette\Forms\Form implements SignalReceiver
2121 public $ onAnchor = [];
2222
2323 /** @var bool */
24- private $ sameSiteProtection = true ;
24+ protected $ crossOrigin = false ;
2525
2626
2727 /**
@@ -103,9 +103,16 @@ public function isAnchored(): bool
103103 /**
104104 * Disables CSRF protection using a SameSite cookie.
105105 */
106+ public function allowCrossOrigin (): void
107+ {
108+ $ this ->crossOrigin = true ;
109+ }
110+
111+
112+ /** @deprecated use allowCrossOrigin() */
106113 public function disableSameSiteProtection (): void
107114 {
108- $ this ->sameSiteProtection = false ;
115+ $ this ->crossOrigin = true ;
109116 }
110117
111118
@@ -153,7 +160,7 @@ public function signalReceived(string $signal): void
153160 $ class = static ::class;
154161 throw new BadSignalException ("Missing handler for signal ' $ signal' in $ class. " );
155162
156- } elseif ($ this ->sameSiteProtection && !$ this ->getPresenter ()->getHttpRequest ()->isSameSite ()) {
163+ } elseif (! $ this ->crossOrigin && !$ this ->getPresenter ()->getHttpRequest ()->isSameSite ()) {
157164 $ this ->getPresenter ()->detectedCsrf ();
158165
159166 } elseif (!$ this ->getPresenter ()->getRequest ()->hasFlag (Nette \Application \Request::RESTORED )) {
You can’t perform that action at this time.
0 commit comments