Commit e1a6aacb by Alexander Makarov

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

Fixes #829: loginRequired now responds with HTTP 403 in case of AJAX or loginUrl is not set (reverted from commit c2c12a90)
parent c0102b41
......@@ -287,8 +287,10 @@ class User extends Component
public function loginRequired()
{
$request = Yii::$app->getRequest();
if ($this->loginUrl !== null && !$request->getIsAjax()) {
if (!$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