/** * Change password * @param Difra\Param\AjaxString $oldpassword * @param Difra\Param\AjaxString $password1 * @param Difra\Param\AjaxString $password2 */ public function passwordAjaxActionAuth(Param\AjaxString $oldpassword, Param\AjaxString $password1, Param\AjaxString $password2) { $user = User::getCurrent(); if (!$user->verifyPassword($oldpassword)) { Ajaxer::status('oldpassword', Locales::get('auth/password/bad_old'), 'problem'); $ok = false; } else { $ok = true; } $reg = new Register(); $reg->setPassword1($password1->val()); $reg->setPassword2($password2->val()); if (!$reg->validatePasswords()) { if ($ok) { Ajaxer::status('oldpassword', Locales::get('auth/password/old_ok'), 'ok'); } $reg->callAjaxerEvents(); return; } if (!$ok) { return; } $user->setPassword($password1->val()); $this->afterPasswordChangeAjax(); }
/** * Activation link * @param AnyString $code */ public function activateAction(AnyString $code) { try { Register::activate($code->val()); $this->afterActivate(); } catch (UsersException $error) { Cookies::getInstance()->notify(Locales::get('auth/activate/' . $error->getMessage()), true); \Difra\View::redirect('/'); } }