app/controllers/UserController.php: adding activationLinkAction()
This commit is contained in:
parent
b6074cf3ef
commit
5cf31430c7
1 changed files with 29 additions and 0 deletions
|
|
@ -58,6 +58,35 @@ class UserController extends ControllerBase
|
|||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate a password.
|
||||
*
|
||||
* @param $id
|
||||
*/
|
||||
public function activationLinkAction($id)
|
||||
{
|
||||
$link = PasswordLink::findFirst(['public_id = ?0', 'bind' => [ $id ]]);
|
||||
|
||||
if ($link) {
|
||||
if ($link->isValid()) {
|
||||
|
||||
// Save the password.
|
||||
$link->getUser()
|
||||
->setPassword($link->getPassword())
|
||||
->save();
|
||||
|
||||
$this->flash->success('Your password has been activated.');
|
||||
} else {
|
||||
$this->flash->error('This link has expired or has already been used.');
|
||||
}
|
||||
|
||||
// Make sure the link is deleted.
|
||||
$link->delete();
|
||||
} else {
|
||||
$this->flash->error('This does not seem to be an active link');
|
||||
}
|
||||
}
|
||||
|
||||
public function activityAction($page = 1)
|
||||
{
|
||||
$user = $this->_getAuth()->getUser();
|
||||
|
|
|
|||
Reference in a new issue