Esempio n. 1
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);
        }
Esempio n. 2
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);
        }