Commit c2c12a90 by Alexander Makarov

Fixes #829: loginRequired now responds with HTTP 403 in case of AJAX or loginUrl is not set

parent 2ecdfd62
......@@ -287,10 +287,8 @@ class User extends Component
public function loginRequired()
{
$request = Yii::$app->getRequest();
if (!$request->getIsAjax()) {
if ($this->loginUrl !== null && !$request->getIsAjax()) {
$this->setReturnUrl($request->getUrl());
}
if ($this->loginUrl !== null) {
Yii::$app->getResponse()->redirect($this->loginUrl)->send();
exit();
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment