ScrewTurn.Wiki.UsersStorageProvider.TryManualLogin C# (CSharp) Method

TryManualLogin() public method

Tries to login a user directly through the provider.
If username or password are null.
public TryManualLogin ( string username, string password ) : UserInfo
username string The username.
password string The password.
return UserInfo
        public UserInfo TryManualLogin(string username, string password)
        {
            if(username == null) throw new ArgumentNullException("username");
            if(password == null) throw new ArgumentNullException("password");

            // Shortcut
            if(username.Length == 0) return null;
            if(password.Length == 0) return null;

            lock(this) {
                string hash = Hash.Compute(password);
                UserInfo[] all = GetUsers();
                foreach(UserInfo u in all) {
                    if(u.Active &&
                        //string.Compare(u.Username, username, false, System.Globalization.CultureInfo.InvariantCulture) == 0 &&
                        //string.Compare(((LocalUserInfo)u).PasswordHash, hash, false, System.Globalization.CultureInfo.InvariantCulture) == 0) {
                        string.CompareOrdinal(u.Username, username) == 0 &&
                        string.CompareOrdinal(((LocalUserInfo)u).PasswordHash, hash) == 0) {
                        return u;
                    }
                }
            }
            return null;
        }