//Authenticate user
        public static USER AuthenticateUser(String username, String password)
        {
            USER user = null;

            foreach (USER u in services.GetUsers())
            {
                if ((u.USERNAME == username || u.EMAIL == username) && MD5_Encoding.VerifyHash(password, u.PASSWORDHASH))
                {
                    user = u;
                    break;
                }
            }

            return(user);
        }
Beispiel #2
0
 public static bool VerifyHash(String input, String initHash)
 {
     return(MD5_Encoding.Encode(input) == initHash);
 }
 public static void ChangePassword(USER user)
 {
     user.PASSWORDHASH = MD5_Encoding.Encode(user.PASSWORDHASH);
     services.UpdateUser(user);
 }
 //insert new Users into the system
 public static USER AddUser(USER user)
 {
     user.PASSWORDHASH = MD5_Encoding.Encode(user.PASSWORDHASH);
     return(services.AddUser(user));
 }