Esempio n. 1
0
        public ActionResult PasswordRecovery(PasswordRecoveryModel model)
        {
            if (!CommonHelper.IsValidEmail(model.Email))
                ModelState.AddModelError("", "Email không hợp lệ!");
            if (ModelState.IsValid)
            {
                var account = _accountService.GetAccountByEmail(model.Email);
                if (account != null && account.Active && !account.Deleted)
                {
                    var passwordRecoveryToken = Guid.NewGuid();
                    _genericAttributeService.SaveAttribute(account, SystemAttributeNames.PasswordRecoveryToken, passwordRecoveryToken.ToString());
                    _workflowMessageService.SendAccountPasswordRecoveryMessage(account, _currentActivity.CurrentLanguage.Id);

                    model.Result = _localizationService.GetResource("Account.PasswordRecovery.EmailHasBeenSent"); //Hệ thống đã gửi một email chứa link phục hồi vào hồm thư của bạn. Xin kiểm tra hòm thư, và kích hoạt liên kết!
                }
                else
                    model.Result = _localizationService.GetResource("Account.PasswordRecovery.EmailNotFound"); //Không tìm thấy tài khoản này, xin cung cấp một tài khoản email chính xác!
            }
            return View(model);
        }
Esempio n. 2
0
 public ActionResult PasswordRecovery()
 {
     var model = new PasswordRecoveryModel();
     if (IsCurrentUserRegistered())
         model.Email = _currentActivity.CurrentAccount.Email;
     return View(model);
 }