File tree 1 file changed +10
-3
lines changed 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
21
21
public $ onAnchor = [];
22
22
23
23
/** @var bool */
24
- private $ sameSiteProtection = true ;
24
+ protected $ crossOrigin = false ;
25
25
26
26
27
27
/**
@@ -103,9 +103,16 @@ public function isAnchored(): bool
103
103
/**
104
104
* Disables CSRF protection using a SameSite cookie.
105
105
*/
106
+ public function allowCrossOrigin (): void
107
+ {
108
+ $ this ->crossOrigin = true ;
109
+ }
110
+
111
+
112
+ /** @deprecated use allowCrossOrigin() */
106
113
public function disableSameSiteProtection (): void
107
114
{
108
- $ this ->sameSiteProtection = false ;
115
+ $ this ->crossOrigin = true ;
109
116
}
110
117
111
118
@@ -153,7 +160,7 @@ public function signalReceived(string $signal): void
153
160
$ class = static ::class;
154
161
throw new BadSignalException ("Missing handler for signal ' $ signal' in $ class. " );
155
162
156
- } elseif ($ this ->sameSiteProtection && !$ this ->getPresenter ()->getHttpRequest ()->isSameSite ()) {
163
+ } elseif (! $ this ->crossOrigin && !$ this ->getPresenter ()->getHttpRequest ()->isSameSite ()) {
157
164
$ this ->getPresenter ()->detectedCsrf ();
158
165
159
166
} elseif (!$ this ->getPresenter ()->getRequest ()->hasFlag (Nette \Application \Request::RESTORED )) {
You can’t perform that action at this time.
0 commit comments