Beispiel #1
0
        public async Task <IHttpActionResult> Login(string phoneNo, string password, LoginDevice loginDevice,
                                                    string clientVersion, string registKey = "")
        {
            var result = await UserContract.Login(phoneNo, password, registKey, loginDevice, clientVersion);

            //if (result.ResultType == OperationResultType.Success)
            //{
            //    OnlineUserStore.ResetLastOperationTime(phoneNo);
            //}

            return(Json(result.ToApiResult()));
        }
        public async Task <IHttpActionResult> ValidateRegister(string phoneNo, string password, string validateCode, LoginDevice loginDevice, string clientVersion, string email, string registKey = "")
        {
            var dto = new UserInfoRegistDto()
            {
                UserName = phoneNo,
                Password = password,
                NickName = "xbxd" + phoneNo,
                Email    = email,
            };
            var result = await UserContract.ValidateRegister(dto, validateCode);

            if (result.Successed)
            {
                return(Json((await UserContract.Login(phoneNo, password, registKey, loginDevice, clientVersion, 1)).ToApiResult()));
            }
            return(Json(result.ToApiResult()));
        }
Beispiel #3
0
        public async Task <ActionResult> Login(FormCollection values, string loginPhone, string loginPassword, int type, LoginDevice loginDevice, string clientVersion = "1.0.0", string registKey = "")
        {
            if (ModelState.IsValid)
            {
                var result = await UserContract.Login(loginPhone, loginPassword, registKey, loginDevice, clientVersion, type);

                if (!result.Successed)
                {
                    return(Json(result.ToApiResult()));
                }
                else
                {
                    var userId     = (result.Data as UserTokenDto).Id;
                    var userString = UserContract.UserInfos.SingleOrDefault(m => m.Id == userId).SysUser.ToJsonString();
                    FormsAuthentication.SetAuthCookie(userString, false);
                }
                return(Json(result.ToApiResult()));
            }
            return(Json(new { ReturnCode = 2, ReturnMsg = "图片验证码有误" }));
        }
        public async Task <IHttpActionResult> LoginByCode(string phoneNo, string code, LoginDevice loginDevice, string clientVersion, string registKey = "")
        {
            var result = await UserContract.Login(phoneNo, code, registKey, loginDevice, clientVersion, 2);

            return(Json(result.ToApiResult()));
        }
        public async Task <IHttpActionResult> Login(string userName, string password, LoginDevice loginDevice, string clientVersion, string registKey = "")
        {
            var result = await UserContract.Login(userName, password, registKey, loginDevice, clientVersion, 1);

            return(Json(result.ToApiResult()));
        }