コード例 #1
0
        public async Task <ActionResult <RegisterUserViewModel> > Register([FromBody] RegisterUserViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }

            if (await _reCaptchaService.IsCaptchaEnabled())
            {
                var captchaSucces = await _reCaptchaService.IsCaptchaPassed();

                if (!captchaSucces)
                {
                    await _mediator.RaiseEvent(new DomainNotification("Recatcha", "ReCaptcha failed"));

                    return(BadRequest(new ValidationProblemDetails(_notifications.GetNotificationsByKey())));
                }
            }

            if (model.ContainsFederationGateway())
            {
                await _userAppService.RegisterWithProvider(model);
            }
            else
            {
                await _userAppService.Register(model);
            }

            model.ClearSensitiveData();
            return(ResponsePost("UserData", "Account", null, model));
        }
コード例 #2
0
        public async Task <ActionResult <RegisterUserViewModel> > Register([FromBody] RegisterUserViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(ModelStateErrorResponseError());
            }

            if (model.ContainsFederationGateway())
            {
                await _userAppService.RegisterWithProvider(model);
            }
            else
            {
                await _userAppService.Register(model);
            }

            model.ClearSensitiveData();
            return(ResponsePost("UserData", "Account", null, model));
        }