Add the possibility to unlock users from the user interface

This commit is contained in:
Frederic Guillot
2016-08-26 21:27:30 -04:00
parent 793eb1074f
commit a24840a533
5 changed files with 33 additions and 1 deletions

View File

@@ -106,4 +106,21 @@ class UserCredentialController extends BaseController
return $this->changeAuthentication($values, $errors);
}
/**
* Unlock user
*/
public function unlock()
{
$user = $this->getUser();
$this->checkCSRFParam();
if ($this->userLockingModel->resetFailedLogin($user['username'])) {
$this->flash->success(t('User unlocked successfully.'));
} else {
$this->flash->failure(t('Unable to unlock the user.'));
}
$this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])));
}
}