/// <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)))); } }
/// <summary> /// 注册 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <RegisterOutput> Register(RegisterInput input) { var user = await _userRegistrationManager.RegisterAsync( input.Name, input.Surname, input.EmailAddress, input.UserName, input.Password, false ); await _userRegistrationManager.BindingThirdPartyAsync(input.Token, user); var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin); return(new RegisterOutput { CanLogin = user.IsActive && (user.IsEmailConfirmed || !isEmailConfirmationRequiredForLogin) }); }
/// <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); }