mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-04-05 04:08:47 +02:00
Fix #857 login to admin with permission inherited from group
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user