Example #1
0
        public Result <ServiceResponse> Login(LoginRequest request)
        {
            return(this.ExecuteMethod(() =>
            {
                request.CheckNotNull();

                if (string.IsNullOrEmpty(request.Username))
                {
                    throw new ArgumentNullException("username");
                }

                var username = request.Username;

                if (WebSecurityHelper.Authenticate(ref username, request.Password, false))
                {
                    LoginLimit.SignIn(username, Session);

                    return new ServiceResponse();
                }

                throw new ValidationError("AuthenticationError", Texts.Validation.AuthenticationError);
            }));
        }