public static bool ChangePassword(string name, string oldpassword, string newpassword) { if (ValidateUser(name, oldpassword)) { User u = DBUserAdapter.LoadWithName(name); u.Login_password = GetMD5(newpassword); return(DBUserAdapter.Update(u)); } else { return(false); } }
public static User LoginOn(string name, string password) { if (ValidateUser(name, password)) { User u = DBUserAdapter.LoadWithName(name); DBUserAdapter.SetLastLoginTimeNow(u.Id); DBUserAdapter.IncLoginCount(u.Id); return(u); } else { return(null); } }
public static bool ValidateUser(string name, string password) { string md5pass = GetMD5(password); if (!Exist(name)) { return(false); } User u = DBUserAdapter.LoadWithName(name); if (u == null) { return(false); } if (u.Login_password == md5pass) { return(true); } else { return(false); } }