public bool ValidateUser(User user, string password)
        {
            bool isValid = false;

            if (user != null && password != null)
            {
                string hashedPassword = password.EncryptSha512(user.Salt);
                isValid = user.EncryptedPassword == hashedPassword;
            }

            return isValid;
        }
 public EqmMembershipUser(string providerName, User currentUser)
     : base(providerName, currentUser.UserName, currentUser.UserId, null, null, null, currentUser.Status.IsApproved(), false, currentUser.CreationDate, currentUser.LastLoginDate, DateTime.Now, DateTime.MinValue, DateTime.MinValue)
 {
     this.EqmId = currentUser.EqmId;
 }
 public override string CreateUserAndAccount(string userName, string password, bool requireConfirmation, IDictionary<string, object> values)
 {
     var newUser = new User() { UserName = userName };
     newUser.EncryptedPassword = password.EncryptSha512(newUser.Salt);
     newUser.IsGoogleAuthenticatorEnabled = (bool)values["IsGoogleAuthenticatorEnabled"];
     newUser.TwoFactorSecret = TwoFactorSecretGenerator.GenerateSecretKey();
     newUser.CreationDate = newUser.LastLoginDate = DateTime.Now;
     using (var db = new MembershipContext())
     {
         db.Set<User>().Add(newUser);
         db.SaveChanges();
     }
     return newUser.UserId.ToString();
 }