Support absolute redirects in the formcontroller
Supports absolute redirects being used in the FormController behaviour.
If the form_config.yaml specifies
```twig
create:
redirect: https://api.example.com/oauth/authorize
```
Then the behaviour will now properly redirect the user to the URL provided where previously it would redirect to a url along the lines of `october.example.com/backend/https://api.example.com/oauth/authorize`. Relative backend redirect URLs are unchanged.
This commit is contained in:
parent
a916d99de4
commit
9840ff228f
|
|
@ -467,7 +467,15 @@ class FormController extends ControllerBehavior
|
|||
$redirectUrl = RouterHelper::parseValues($model, array_keys($model->getAttributes()), $redirectUrl);
|
||||
}
|
||||
|
||||
return ($redirectUrl) ? Backend::redirect($redirectUrl) : null;
|
||||
if (starts_with($redirectUrl, 'http://') || starts_with($redirectUrl, 'https://')) {
|
||||
// Process absolute redirects
|
||||
$redirect = Redirect::to($redirectUrl);
|
||||
} else {
|
||||
// Process relative redirects
|
||||
$redirect = ($redirectUrl) ? Backend::redirect($redirectUrl) : null;
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue