示例#1
0
        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("");
        }
示例#2
0
        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);
        }
示例#3
0
 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("");
 }
示例#4
0
        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);
        }