예제 #1
0
        public ApiAccountReponse RegisterNormal(PostCreateAccount data)
        {
            try
            {
                int captchaVeriryStatus = Utilities.Captcha.Verify(data.captcha, data.token);
                if (captchaVeriryStatus < 0)
                {
                    return new ApiAccountReponse {
                               Code = captchaVeriryStatus
                    }
                }
                ;
                var account  = new Models.Account();
                int response = account.RegisterNormal(data.username, data.password);
                if (response < 0)
                {
                    return new ApiAccountReponse {
                               Code = response
                    }
                }
                ;
                SetAuthCookie(account.AccountID, "U." + account.AccountID, data.device, 1);
                LogDAO.Login(data.device, IPAddressHelper.GetClientIP(), account.AccountID, 1, true);
                return(new ApiAccountReponse {
                    Code = response, Account = account
                });
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
            }

            return(new ApiAccountReponse
            {
                Code = -99
            });
        }