public Model.Employee Authenticate(Model.Credential credential)
        {
            // get employee for email
            var employee = _storage.GetByEmail(credential.Email);

            if (employee == null)
            {
                throw new Exception("Invalid email.");
            }
            // check if password matches
            //if (CryptoProvider.CompareHash(credential.Password, employee.Password))
            //    return employee;
            //else
            //    throw new Exception("Invalid password.");
            return(employee);
        }
Exemplo n.º 2
0
        public Employee Authenticate(Credential credential)
        {
            var employee = _storage.GetByEmail(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.");
            }
        }
Exemplo n.º 3
0
        // GET: api/employee/[email protected]
        public Employee SearchByEmail(string email)
        {
            var result = _employeeStore.GetByEmail(email);

            return(result);
        }