public static bool ChangePassword(ResetPasswordDto resetPassVm) { return AccountDao.Instance.ResetPassword(resetPassVm); }
public bool ResetPassword(ResetPasswordDto resetPassVm) { User user = _db.Users. FirstOrDefault(x => x.Email == resetPassVm.Email && x.ResetPassword == resetPassVm.ResetCode); if (user != null) { try { var hash = Encoding.ASCII.GetBytes("san" + resetPassVm.Password); var sha1 = new SHA1CryptoServiceProvider(); byte[] sha1Hash = sha1.ComputeHash(hash); var hashedPassword = Encoding.ASCII.GetString(sha1Hash); user.Password = hashedPassword; _db.SaveChanges(); return true; } catch (Exception) { return false; } } return false; }