public BaseResponse SignUp(SignUpRequest user) { var validation = new SignUpValidator().Validate(user); if (!validation.IsValid) { return(DefaultValidationFailure(validation.Errors)); } if (_userRepository.GetUserPkByEmail(user.Email) != Guid.Empty) { return(CreateValidationFailure("email", "Email already in use", user.Email)); } var entity = _mapper.Map <SignUpRequest, User>(user); CreatePasswordHash(user.Password, out var passwordHash, out var passwordSalt); entity.PasswordHash = passwordHash; entity.PasswordSalt = passwordSalt; entity.RequestEmailConfirmation(); _userRepository.Insert(entity); var response = _mapper.Map <SignUpRequest, UserResponse>(user); return(DefaultSuccess(response)); }
private void SignUpPopupConfirm_Clicked(object sender, EventArgs e) { if (!SignUpValidator.ValidateAll()) { return; } SignUpAsync(SignUpLoginEntry.Text, SignUpPasswordEntry.Text, SignUpEmailEntry.Text); }
public void SetUp() { _fakeSignUpService = A.Fake <ISignUpService>(); _fakeLoginService = A.Fake <ILoginService>(); var _fakeBookwormDbContext = A.Fake <BookwormDbContext>(); _signUpController = new SignUpController(_fakeSignUpService); _fakeRepository = new Repository <User>(_fakeBookwormDbContext); _validator = A.Fake <SignUpValidator>(); }
public MainPage() { InitializeComponent(); PopupControl = new PopupControlSystem(OnBackButtonPressed); SignUpPopup.OnPopupBodyClicked += Constants.CLICK_IGNORE; LogInPopup.OnPopupBodyClicked += Constants.CLICK_IGNORE; ErrorPopup.OnFirstButtonClicked = AuthErrorClose_Clicked; SignUpValidator = new SignUpValidator(SignUpLoginEntry, SignUpPasswordEntry, SignUpPasswordConfirmEntry, SignUpEmailEntry, Constants.VALID_HANDLER, Constants.INVALID_HANDLER); LogInValidator = new LogInValidator(LogInLoginEntry, LogInPasswordEntry, Constants.VALID_HANDLER, Constants.INVALID_HANDLER); }
public void SignUp_Validator() { var signUpValidator = new SignUpValidator(); var signUpRequest = new SignUpRequest() { Email = "*****@*****.**", Password = "******", FirstName = "Berkay", LastName = "Yerdelen", UserName = "******" }; var result = signUpValidator.Validate(signUpRequest); Assert.True(result.IsValid); }
private void SignUp() { var toValidate = new SignUpObject() { FirstName = FirstName, LastName = LastName, PhoneNumber = PhoneNumber, Email = Email, Password = Password, AcceptTerms = IsTermsAccepted }; SignUpValidator validator = new SignUpValidator(); ValidationResult results = validator.Validate(toValidate); if (results.IsValid) { //call api to sign up //then go to menu page ShowViewModel <MenuViewModel>(); } else { Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, results.Errors[0].ToString().Trim())); } }
public ActionResult Index(string userName, string password) { //validation SignUpValidator validator = new SignUpValidator(); var validResult = validator.validate(userName, password); if (validResult.Count == 0) { //Creating a new admin AdministratorManager adminManager = new AdministratorManager(); adminManager.createAdministrator(userName, password); ViewBag.Success = 1; } else { ViewBag.Validation = validResult; } return(View("SignUp")); }
public SignUpController(ISignUpService signUp) { _signUpService = signUp; _validator = new SignUpValidator(); }
public void SetTestUp() { _validator = new SignUpValidator(); }
private async void SignUp() { View.HideKeyboard(); SignUpValidator validator = new SignUpValidator(); Register register = new Register { Email = Email, Password = Password, ConfirmPassword = ConfirmPassword }; var result = validator.Validate(register); if (result.IsValid) { mPlatformService.ShowNetworkIndicator(); mProgressDialogService.ShowProgressDialog(); var response = await mApiService.PostSignup(register); //mPlatformService.HideNetworkIndicator(); //mProgressDialogService.HideProgressDialog(); if (response.StatusCode == HttpStatusCode.OK) { //mPlatformService.ShowNetworkIndicator(); //mProgressDialogService.ShowProgressDialog(); var response2 = await mApiService.PostLogin(Email, Password); //mPlatformService.HideNetworkIndicator(); //mProgressDialogService.HideProgressDialog(); if (response2.StatusCode == HttpStatusCode.OK) { var userData = response2.Data; mCacheService.CurrentUserData = userData; mApiService.UseBeaerToken = true; // get userkey //mPlatformService.ShowNetworkIndicator(); //mProgressDialogService.ShowProgressDialog(); var response3 = await mApiService.PostSession(mPlatformService.GetDeviceUDID(), userData.UserName); //mPlatformService.HideNetworkIndicator(); //mProgressDialogService.HideProgressDialog(); if (response3.StatusCode == HttpStatusCode.OK) { userData.UserKey = response3.Data; mCacheService.CurrentUserData = userData; await GetProfile(); ShowViewModel <MainViewModel>(); } else { mApiService.UseBeaerToken = false; } } } else if (response.StatusCode == HttpStatusCode.BadRequest) { //string errorData = response.ErrorData; //mMessageboxService.ShowToast(errorData); mMessageboxService.ShowToast("Email already in use!"); mPlatformService.HideNetworkIndicator(); mProgressDialogService.HideProgressDialog(); } } else if (result.Errors != null) { var firstError = result.Errors.First(); mMessageboxService.ShowToast(firstError.ErrorMessage); mPlatformService.HideNetworkIndicator(); mProgressDialogService.HideProgressDialog(); } }