Exemple #1
0
        public async Task <Employee> AuthenticateAsync(Credential credential)
        {
            var employee = await _storage.GetByEmailAsync(credential.Email);

            if (employee == null)
            {
                throw new Exception("Invalid email.");
            }
            // check if password matches
            if (credential.Password.Equals(employee.Password))
            {
                return(employee);
            }
            else
            {
                throw new Exception("Invalid password.");
            }
        }