Example #1
0
 private static function _ChangeEmail($hash)
 {
     unset($_SESSION['isSend']);
     global $smarty;
     $oldEmail = $_GET['old_email'];
     $newEmail = $_GET['new_email'];
     $_user = new User();
     $userInfo = $_user->SetSamplingScheme(User::ACTIVATION_SCHEME)->GetByEmail($oldEmail);
     if (empty($userInfo)) {
         throw new Exception(SEND_INCORRECT_MAIL);
     }
     $userPass = $userInfo[$_user->ToPrfxNm(User::PASS_FLD)];
     $mail = new Mail();
     if ($mail->compareUniqueSignature($hash, $newEmail, $userPass)) {
         AuthorizedUser::ChangeEmail($oldEmail, $newEmail, $userPass);
     } else {
         throw new Exception(ERROR_CHANGE_MAIL);
     }
     $smarty->assign('isGoAcc', true)->assign('successMsg', 'E-mail успешно изменен.');
 }