Exemplo n.º 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);
        }
Exemplo n.º 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());
        }
Exemplo n.º 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(""));
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        public UserDto SignUp([FromBody] SignUpDto user)
        {
            var result = _signUpService.SignUp(user);

            return(result);
        }
 public SignUpResponse SignUp([FromBody] SignUpRequest request)
 {
     return(_signUpService.SignUp(request));
 }
        public IHttpActionResult CreateAccount([FromBody] SignUpInput input)
        {
            var result = _signupService.SignUp(input);

            return(Ok(result));
        }
        public Response SignUp([FromBody] SignUpRequest request)
        {
            var ret = _service.SignUp(request);

            return(ret);
        }