app/controllers/UserController.php: move activateLinkAction() to ApiController
This commit is contained in:
parent
bd5a8402e6
commit
7c24e2ea5e
3 changed files with 40 additions and 40 deletions
|
|
@ -106,44 +106,6 @@ class UserController extends ControllerBase
|
|||
$this->response->redirect('/settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Account/Password activation.
|
||||
*
|
||||
* @Acl(resource="auth")
|
||||
* @param $id
|
||||
*/
|
||||
public function activationLinkAction($id)
|
||||
{
|
||||
$link = UserActivation::findFirst(['activation_key = ?0', 'bind' => [ $id ]]);
|
||||
|
||||
if ($link) {
|
||||
if ($link->isValid()) {
|
||||
|
||||
$user = $link->getUser();
|
||||
|
||||
// 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.');
|
||||
}
|
||||
|
||||
// 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