/// <summary> /// Logins the specified user name. /// </summary> /// <param name="password">The users password.</param> /// <returns></returns> public bool Login(string password) { bool result = false; MasterSecret masterSecret = _passwordRepository.GetMasterSecret(_cMasterSecretName); string hashedPassword = _securityService.HashData(password).Result; if (hashedPassword == masterSecret.Password) { result = true; } else { if (masterSecret.NumberOfAttemptsLeft > 0) { masterSecret.NumberOfAttemptsLeft -= masterSecret.NumberOfAttemptsLeft; } else { masterSecret.NumberOfAttemptsLeft = _cMaxNumberOfAttempts; } } return(result); }