Beispiel #1
0
        public GenericResponseModel <AuthResponseModel> AuthenticateUser(AuthRequestModel login)
        {
            var response = new GenericResponseModel <AuthResponseModel>();

            try
            {
                var da          = new AuthDA();
                var resultLogin = da.Login(login);
                if (!resultLogin)
                {
                    response.ErrorMessage = "User didn't Exists !";
                    return(response);
                }

                var msg = string.Empty;
                response.Value  = da.GetDataUser(login.UserName, ref msg);
                response.Status = true;
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.ToString();
            }

            return(response);
        }
        public int ResetSystemUserPassword(string loginName, string oldPassword, string newPassword, string applicationKey)
        {
            var result = AuthDA.Login(loginName, oldPassword, applicationKey);

            if (result == null)
            {
                throw new BusinessException("原密码错误!");
            }

            int    EditUserSysNo = DataContext.GetContextItemInt("UserSysNo", 0);
            string EditUserName  = DataContext.GetContextItemString("UserDisplayName");

            return(SystemUserDA.ResetSystemUserPassword(loginName, newPassword, applicationKey, EditUserSysNo, EditUserName));
        }
        public AuthUserModel Login(string userID, string pwd, string applicationKey)
        {
            var result = AuthDA.Login(userID, pwd, applicationKey);

            if (result == null)
            {
                throw new BusinessException("账号或密码错误!", 10);
            }
            if (result.CommonStatus != 1)
            {
                throw new BusinessException("您的账户已被禁用,请联系您的管理员。");
            }
            //生成登录时间
            result.LoginTime = DateTimeHelper.GetTimeZoneNow();
            return(result);
        }