Example #1
0
        /// <inheritdoc />
        public async Task <JsonResult> BindingThirdParty(BindingThirdPartyInput input)
        {
            try
            {
                var result = await _logInManager.LoginAsync(input.UserName, input.Password);

                if (result.Result != AbpLoginResultType.Success)
                {
                    throw new UserFriendlyException("用户名或密码输入错误");
                }
                if (string.IsNullOrEmpty(input.Token))
                {
                    throw new UserFriendlyException("第三方认证令牌有误或者已失效,请重新绑定");
                }
                await _userRegistrationManager.BindingThirdPartyAsync(input.Token, result.User);
                await SignInAsync(result.User);

                return(Json(new AjaxResponse()));
            }
            catch (Exception ex)
            {
                LogHelper.LogException(Logger, ex);
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                EventBus.Trigger(this, new AbpHandledExceptionData(ex));
                return(Json(new AjaxResponse(ErrorInfoBuilder.BuildForException(ex))));
            }
        }
Example #2
0
        /// <inheritdoc />
        public async Task BindingThirdParty(BindingThirdPartyInput input)
        {
            var result = await _loginManager.LoginAsync(input.UserName, input.Password);

            if (result.Result != AbpLoginResultType.Success)
            {
                throw new UserFriendlyException("�û����������������");
            }
            if (string.IsNullOrEmpty(input.Token))
            {
                throw new UserFriendlyException("��������֤�������������ʧЧ�������°�");
            }
            await _userRegistrationManager.BindingThirdPartyAsync(input.Token, result.User);
        }