Пример #1
0
 public ActionResult ResetPasswd(ResetPasswdViewModel model)
 {
     if (new Accounts().EmailExist(model.Email))
     {
         string resetCode = Guid.NewGuid().ToString();
         try
         {
             SendVerificationLinkEmail(model.Email, resetCode);
             Accounts account = new Accounts();
             Users    user    = new Users();
             user.Email = model.Email;
             var         sessionInfo = account.SessionUserInfo(user);
             ResetPasswd info        = new ResetPasswd()
             {
                 Id = resetCode, UserId = sessionInfo.Id, ResetRequestDateTime = DateTime.Now
             };
             if (account.AddResetPasswordLinkRecord(info))
             {
                 ModelState.AddModelError("", "Reset password link has been sent to your email id.");
             }
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", "Oops! Some Error Occured.\nPlease Try Again Later.");
         }
     }
     else
     {
         ModelState.AddModelError("", "Account Doesn't Exist!");
     }
     return(View());
 }
Пример #2
0
 public bool ResetPasswdLink(ResetPasswd info)
 {
     try
     {
         db.ResetPassword.Add(info);
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         var ravenClient = new RavenClient("https://[email protected]/1820886");
         ravenClient.Capture(new SentryEvent(ex));
         return(false);
     }
 }
Пример #3
0
 /// <summary>
 /// Update a record in Database for the Reset password Link sent to the user.
 /// </summary>
 /// <param name="info"></param>
 /// <returns>Flag as true if Added Successfully else false</returns>
 public bool AddResetPasswordLinkRecord(ResetPasswd info)
 {
     try
     {
         UserInformation user = new UserInformation();
         if (user.ResetPasswdLink(info))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }