コード例 #1
0
        // public async Task<Response<AuthInfoDTO>> SignUpMemberGoogle(SignUpMemberGoogleDTO dto)
        // {
        //     var signUpResult = await _service.SignUpMemberGoogle(dto);
        //     if (!signUpResult.IsSuccess)
        //     {
        //         var errorResponse = (ErrorResponse) signUpResult;
        //
        //         return new ErrorResponse<AuthInfoDTO>
        //         {
        //             Message = errorResponse.Message,
        //             Code = errorResponse.Code,
        //             Errors = errorResponse.Errors,
        //             HttpStatusCode = errorResponse.HttpStatusCode
        //         };
        //     }
        //
        //     var resultToken = await _tokensService.GoogleAuthenticate(dto.Token);
        //
        //     return resultToken;
        // }

        public async Task <Response <AuthInfoDTO> > SignUp(string email, string password)
        {
            var signUpResult = await _service.SignUp(email, password);

            if (!signUpResult.IsSuccess)
            {
                var errorResponse = (ErrorResponse <UserDTO>)signUpResult;

                return(new ErrorResponse <AuthInfoDTO>
                {
                    Message = errorResponse.Message,
                    Code = errorResponse.Code,
                    Errors = errorResponse.Errors,
                    HttpStatusCode = errorResponse.HttpStatusCode
                });
            }

            var resultToken = await _tokensService.Authenticate(new CredentialsDTO
            {
                Password = password,
                Email    = email
            });

            return(resultToken);
        }
コード例 #2
0
        public void TestSignUpWithValidUsernameAndEmail(string email, string username)
        {
            var       expectedType = typeof(SignUpResponseOk);
            const int dataCount    = 5;
            //given a database with some data
            var dummyData = _testUtilitiesImpl.CreateUserDummyData(_signUpService, dataCount);

            //when we try to signup new user with valid data (not existing in db)
            var login = new LoginDto {
                Email = email, Username = username
            };
            var request = new SignUpRequest {
                Login = login
            };
            var result = _signUpService.SignUp(request);

            //we get SignUpResponseOk
            Assert.That(result, Is.TypeOf(expectedType));

            dummyData.Add(email);
            _testUtilitiesImpl.DestroyUserDummyData(dummyData.ToArray());
        }
コード例 #3
0
 public ActionResult SignUp(UserViewModel_Signup u)
 {
     if (ModelState.IsValid)
     {
         User usr = signUp.SignUp(u);
         return(Redirect(Url.Action("index", "home")));
     }
     else
     {
         ModelState.AddModelError("", "Already registered user or invalid data entry. Try again.");
         return(View(""));
     }
 }
コード例 #4
0
        public List <string> CreateUserDummyData(ISignUpService signUpService, int dataCount)
        {
            var retval = new List <string>();

            for (int i = 0; i < dataCount; i++)
            {
                var userResponse =
                    signUpService.SignUp(new SignUpRequest {
                    Login = new LoginDto {
                        Email = UserPrefix + i, Username = "******" + i
                    }
                });
                retval.Add(((SignUpResponseOk)userResponse).SignUpRequest.Login.Email);
            }

            return(retval);
        }
コード例 #5
0
        public UserDto SignUp([FromBody] SignUpDto user)
        {
            var result = _signUpService.SignUp(user);

            return(result);
        }
コード例 #6
0
 public SignUpResponse SignUp([FromBody] SignUpRequest request)
 {
     return(_signUpService.SignUp(request));
 }
コード例 #7
0
        public IHttpActionResult CreateAccount([FromBody] SignUpInput input)
        {
            var result = _signupService.SignUp(input);

            return(Ok(result));
        }
コード例 #8
0
        public Response SignUp([FromBody] SignUpRequest request)
        {
            var ret = _service.SignUp(request);

            return(ret);
        }