public override string CreateAccount(string userName, string password, bool requireConfirmationToken) { var user = new user(); user.email = userName; user.password = MD5Helper.StringToMD5(password); db.users.Add(user); db.SaveChanges(); return(""); }
public override bool ChangePassword(string username, string oldPassword, string newPassword) { var user = db.users.FirstOrDefault(p => p.email == username && p.password == MD5Helper.StringToMD5(oldPassword)); if (user != null) { user.password = MD5Helper.StringToMD5(newPassword); db.Entry(user).State = System.Data.EntityState.Modified; db.SaveChanges(); } return(false); }
public override string CreateUserAndAccount(string userName, string password, bool requireConfirmation, IDictionary <string, object> values) { try { var user = new user(); user.email = userName; user.password = MD5Helper.StringToMD5(password); db.users.Add(user); db.SaveChanges(); } catch (Exception ex) { throw; } return(""); }
public override bool ValidateUser(string username, string password) { string hashed = MD5Helper.StringToMD5(password); return(db.users.Count(p => p.email == username && p.password == hashed) > 0); }