Exemple #1
0
        public bool ValidateUser(string username, string password)
        {
            var result = from acc in _db.Accounts where (acc.Username == username) select acc;

            if (result.Count() != 0)
            {
                var dbaccount = result.First();

                Crypt crypt = new Crypt();

                if (dbaccount.Password == crypt.CreatePasswordHash(password, dbaccount.PasswordSalt) &&
                    dbaccount.IsActivated == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }