Fix #857 login to admin with permission inherited from group

This commit is contained in:
Flavio Copes
2016-11-08 16:42:57 +01:00
parent 40e668919d
commit 63c83d785c
3 changed files with 49 additions and 30 deletions

View File

@@ -318,22 +318,29 @@ class Admin
// Authenticate user.
$result = $user->authenticate($data['password']);
if ($result) {
$this->user = $this->session->user = $user;
/** @var Grav $grav */
$grav = $this->grav;
unset($this->grav['user']);
$this->grav['user'] = $user;
$this->setMessage($this->translate('PLUGIN_ADMIN.LOGIN_LOGGED_IN'), 'info');
$grav->redirect($post['redirect']);
if (!$result) {
return false;
}
}
}
return $this->authorize();
$action = [];
if ($user->authorize('admin.login')) {
$this->user = $this->session->user = $user;
/** @var Grav $grav */
$grav = $this->grav;
unset($this->grav['user']);
$this->grav['user'] = $user;
$this->setMessage($this->translate('PLUGIN_ADMIN.LOGIN_LOGGED_IN'), 'info');
$grav->redirect($post['redirect']);
return true; //never reached
}
return false;
}
/**