app/controllers/UserController.php: in activateLinkAction() accept account activation also.
This commit is contained in:
parent
2faf85359a
commit
2335c61644
1 changed files with 15 additions and 6 deletions
|
|
@ -107,8 +107,9 @@ class UserController extends ControllerBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Activate a password.
|
||||
* Account/Password activation.
|
||||
*
|
||||
* @Acl(resource="auth")
|
||||
* @param $id
|
||||
*/
|
||||
public function activationLinkAction($id)
|
||||
|
|
@ -118,12 +119,20 @@ class UserController extends ControllerBase
|
|||
if ($link) {
|
||||
if ($link->isValid()) {
|
||||
|
||||
// Save the password.
|
||||
$link->getUser()
|
||||
->setPassword($link->getPassword())
|
||||
->save();
|
||||
$user = $link->getUser();
|
||||
|
||||
$this->flash->success('Your password has been activated.');
|
||||
// Save password if any is set.
|
||||
if (strlen($link->getPassword()) > 0) {
|
||||
$user->setPassword($link->getPassword());
|
||||
$this->flash->success('Your password has been activated.');
|
||||
} else {
|
||||
$user->setStatus(User::STATUS_ACTIVE);
|
||||
$this->flash->success('Your account has been activated.');
|
||||
|
||||
// Also login the user.
|
||||
$this->auth->systemLogin($user);
|
||||
}
|
||||
$user->save();
|
||||
} else {
|
||||
$this->flash->error('This link has expired or has already been used.');
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue