Example #1
0
 public IActionResult ForgotPassword(ForgotMyPasswordViewModel forgotMyPassword)
 {
     if (ModelState.IsValid)
     {
         var user = dBContext.Users.FirstOrDefault(x => x.UserEMail == forgotMyPassword.Email);
         if (user != null)
         {
             if (user.UserIsEmailConfirmed && user.UserToken == null)
             {
                 var token = _tokenGenerator.GetToken(null);
                 user.UserToken = token;
                 _unitOfWorkUser.RepositoryUser.Update(user);
                 _unitOfWorkUser.Complete();
                 string mailSubject       = "ŞİFRE YENİLEME";
                 var    passwordResetLink =
                     Url.Action("ResetPassword", "Account", new
                 {
                     email = forgotMyPassword.Email,
                     token = token
                 }, Request.Scheme
                                );
                 var messageModel = new MessageModel(user.UserName, user.UserSurname, user.UserEMail, mailSubject, passwordResetLink, "forgot-password", null);
                 _emailSender.EmailSendWithMimeAsync(messageModel);
                 TempData["Message"] = "Şifre sıfırlama bağlantınız E-mail adresinize başarıyla yollanmıştır !!";
                 TempData["JS"]      = "showSuccess();";
                 return(RedirectToAction("Login", new { isForgotPassword = true }));
             }
             else
             {
                 ViewBag.Message = "Hesabınız aktif değil ya da doğrulanmamış! Lütfen hesabınızı doğrulayınız.";
                 ViewBag.JS      = "showControllerError();";
                 return(View());
             }
         }
         else
         {
             ViewBag.Message = "Girmiş olduğunuz e-mail adresi sistemimizde kayıtlı değil!";
             ViewBag.JS      = "showControllerError();";
             return(View());
         }
     }
     else
     {
         ViewBag.Message = "Hatalı veri girişi!";
         ViewBag.JS      = "showControllerError();";
         return(View(forgotMyPassword));
     }
 }
Example #2
0
 public ActionResult ForgotPassword(ForgotMyPasswordViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BarcoSoftUtilidades.Seguridad.Usuario.RecoverPassword(model.Email, Url.Action("RecoverPassword", null, null, Request.Url.Scheme));
             ViewBag.Exito = "Te hemos enviado un correo con las instrucciones para recuperar tu contraseña, favor verifica.";
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, ex.Message);
     }
     return(View());
 }
Example #3
0
 public ActionResult ForgotPassword(ForgotMyPasswordViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BarcoSoftDBEntities db = new BarcoSoftDBEntities(true);
             // model.u
         }
     }
     catch (Exception ex)
     {
         ViewBag.boolResultado = false;
         ViewBag.mensajerError = ex.Message;
     }
     return(View());
 }