コード例 #1
0
        public PreSingUpResponse PreSingUp(PreSignUpRequest request)
        {
            new Assertor(mess => new NotValidRequestException(mess))
            .Add(() => !string.IsNullOrEmpty(request.Login), "Login can't be empty")     // Check Login correctness
            .Add(() => !string.IsNullOrEmpty(request.Email), "Email can't be empty")     // Check Email correctness
            .Assert();

            var loginExists = mRepositoriesManager.UsersRepository.IsLoginExist(request.Login);
            var emailExists = mRepositoriesManager.UsersRepository.IsEmailExists(request.Email);

            if (loginExists || emailExists)
            {
                return new PreSingUpResponse
                       {
                           IsSuccess   = false,
                           EmailExists = emailExists,
                           LoginExists = loginExists
                       }
            }
            ;

            return(new PreSingUpResponse
            {
                IsSuccess = true,
                Url = "/register.html"
            });
        }
    }
コード例 #2
0
        public virtual IActionResult PreSingUp([FromBody] PreSignUpRequest request)
        {
            mLogger.Info("", Codes.PreSignup, "User presign up.", mReferenceId,
                         new { request });

            var result = mCore.AuthenticationApi.PreSingUp(request);

            if (result.IsSuccess)
            {
                var signupKey = mSignupDataProvider.StoreSignUpData(new SignUpData
                {
                    Login = request.Login,
                    Email = request.Email
                });

                result.Url += $"?sk={signupKey}&l={request.Login}";
            }

            return(new ObjectResult(result));
        }