Esempio n. 1
0
        public SignIn LogOn(LogOn model)
        {
            var logon = _accountService.LogOn(model);

            if (logon == null)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "User Unauthorized"));
            }

            return logon;
        }
Esempio n. 2
0
        public SignIn LogOn(LogOn model)
        {
            using (var db = _documentStore.OpenSession())
            {
                var user = db.Query<User>()
                            .Where(m => m.Email == model.Email)
                            .SingleOrDefault();

                if (user != null && HashHelper.CompareHash(model.Password + user.Salt, user.PasswordHash))
                {
                    return SignInUser(user);
                }
            }

            return null;
        }