public FluentValidationPage() { InitializeComponent(); _viewModel = new SignUpPageViewModel(); BindingContext = _viewModel; finishButton.Clicked += async(s, e) => await Navigation.PopModalAsync(); }
public SignUpPage() { InitializeComponent(); _viewModel = BindingContext as SignUpPageViewModel; ConfirmPasswordEntry.Unfocused += ConfirmPasswordEntry_Unfocused;; ConfirmPasswordEntry.TextChanged += ConfirmPasswordEntry_TextChanged;; }
public async Task ShouldNavigateToConfirmationPage() { var accountService = new Mock <IAccountService>(); accountService.Setup(s => s.SignUp(It.IsAny <SignUpRequest>())).ReturnsAsync(new SignUpResponseModel(1)).Verifiable(); viewService .Setup(m => m.SetCurrentPage(It.Is((BaseViewModel p) => p.GetType() == typeof(ConfirmationCodeEntryViewModel)))) .Verifiable(); ConfirmationCodeEntryViewModel CreateConfirmationCodeEntryViewModel(int requestId) => new ConfirmationCodeEntryViewModel(requestId, null, null, null, null, null, null); var viewModel = new SignUpPageViewModel(accountService.Object, CreateConfirmationCodeEntryViewModel, dataFlow.Object, viewService.Object, () => phoneService.Object, deviceInfo.Object, connectivity.Object, appInfo.Object) { View = view.Object, FirstName = { Value = "Jhon" }, LastName = { Value = "Smith" }, MobileNumber = { Value = "+614245373" }, EmailAddress = { Value = "*****@*****.**" } }; Assert.True(viewModel.CanSignUp()); await viewModel.SignUp(); // Assert that there is a naviation call to confirmation page viewService.Verify(); accountService.Verify(); }
/// <summary> /// Initializes a new instance of the <see cref="SignUpPage" /> class. /// </summary> public SignUpPage() { var authorizationService = App.Kernel.Get <IAuthorizationService>(); InitializeComponent(); BindingContext = new SignUpPageViewModel(this, authorizationService); }
public SignUpPage() { InitializeComponent(); viewModel = App.Locator.SignUp; BindingContext = viewModel; // btnSubmit.Clicked += BtnSubmit_Clicked; Title = "SignUp"; }
/// <summary> /// Initializes a new instance of the <see cref="SimpleSignUpPage" /> class. /// </summary> public SimpleSignUpPage() { InitializeComponent(); var userDataService = App.MockDataService ? TypeLocator.Resolve <IUserDataService>() : DataService.TypeLocator.Resolve <IUserDataService>(); BindingContext = new SignUpPageViewModel(userDataService); }
public ActionResult SignUp([FromBody] SignUpPageViewModel model) { var redirectUrl = ""; if (!ModelState.IsValid) { redirectUrl = Url.Action("Index", "SignUp"); //return RedirectToAction("Index", "SignUp"); return(Json(new { redirectUrl })); } byte[] salt; new RNGCryptoServiceProvider().GetBytes(salt = new byte[16]); var passwordEncryption = new PasswordEncription(); string encryptPassword = passwordEncryption.EncryptPassword(model.Password, configuration["AppSettings:PasswordKey"]); Users user = new Users(); user.Email = model.Email; user.Password = encryptPassword; user.Username = model.Username; user.Role = Roles.User; user.Salt = Encoding.UTF8.GetString(salt, 0, salt.Length); var userDb = db.Users.Where(x => x.Email == model.Email).FirstOrDefault(); if (userDb != null) { //throw an error } using (var db = new ApplicationDbContext()) { var users = db.Set <Users>(); users.Add(user); db.SaveChanges(); } var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Email, user.Email) }, CookieAuthenticationDefaults.AuthenticationScheme); var principal = new ClaimsPrincipal(identity); var claim = new Claim(ClaimTypes.Role, "User"); identity.AddClaim(claim); var login = HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal); redirectUrl = Url.Action("Index", "Home"); //return RedirectToAction("Index", "Home"); return(Json(new { redirectUrl })); }
public FluentValidationPage() { InitializeComponent(); _viewModel = new SignUpPageViewModel(); BindingContext = _viewModel; this.IconImageSource = new FontImageSource { FontFamily = "fa-solid", Size = 30, Glyph = "\uf044", Color = Color.Blue }; this.Title = string.Empty; }
public void ValidationTest() { var viewModel = new SignUpPageViewModel(new Mock <IAccountService>().Object, null, dataFlow.Object, viewService.Object, () => phoneService.Object, deviceInfo.Object, connectivity.Object, appInfo.Object) { View = view.Object, FirstName = { Value = "" }, LastName = { Value = "Smith" }, MobileNumber = { Value = "+614245373" }, EmailAddress = { Value = "*****@*****.**" } }; Assert.False(viewModel.CanSignUp()); viewService.Verify(m => m.SetCurrentPage(It.IsAny <BaseViewModel>()), Times.Never); }
public static void ShowWindow() { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "创建账号", IconName = "Icon_SignUp", Width = 370, IsMaskTheParent = true, CloseVisible = System.Windows.Visibility.Visible, FooterVisible = System.Windows.Visibility.Collapsed }, ucFactory: (window) => { SignUpPageViewModel vm = new SignUpPageViewModel(); window.BuildCloseWindowOnecePath(vm.Id); return(new SignUpPage(vm)); }, beforeShow: (window, uc) => { uc.DoFocus(); }, fixedSize: true); }
public SignUpPage() { InitializeComponent(); SignUpPageViewModel = new SignUpPageViewModel(); SignUpPageViewModel.navigation = Navigation; this.BindingContext = SignUpPageViewModel; //usernameEntry.Completed += (object sender, EventArgs e) => //{ // passwordEntry.Focus(); //}; //passwordEntry.Completed += (object sender, EventArgs e) => //{ // passwordReEntry.Focus(); //}; //passwordReEntry.Completed += (object sender, EventArgs e) => //{ // firstnameEntry.Focus(); //}; //firstnameEntry.Completed += (object sender, EventArgs e) => //{ // lastnameEntry.Focus(); //}; //lastnameEntry.Completed += (object sender, EventArgs e) => //{ // emailEntry.Focus(); //}; //emailEntry.Completed += (object sender, EventArgs e) => //{ // phonenumberEntry.Focus(); //}; //phonenumberEntry.Completed += (object sender, EventArgs e) => //{ // SignUpPageViewModel.SignUpCommand.Execute(null); //}; }
public SignUpPage() { InitializeComponent(); BindingContext = new SignUpPageViewModel(); if (Device.RuntimePlatform == Device.iOS) { var closeButton = new Button { Text = "X", FontAttributes = FontAttributes.Bold, TextColor = Color.DarkRed, FontSize = 22, HorizontalOptions = LayoutOptions.End }; closeButton.SetBinding(Button.CommandProperty, "GoBackCommand", BindingMode.TwoWay); signUpGrid.Children.Add(closeButton, 1, 0); } }
public void SignUpCommand_UserDetailsIsValid_StoresUserEmailAndPasswordInVariables() { var authentication = new Mock <IAuthentication>(); authentication.Setup(signup => signup.SignupUser(new RegisterUser())).Returns("Data saved..."); var signUpPageViewModel = new SignUpPageViewModel(authentication.Object, _page); signUpPageViewModel.SignUpCommand.Execute(new RegisterUser()); var user = new RegisterUser { Email = "FakeEmail", Password = "******" }; var email = user.Email.ToString(); var password = user.Password.ToString(); Assert.AreEqual("FakeEmail", email); Assert.AreEqual("FakePassword", password); }
public ActionResult CreateUser([FromBody] SignUpPageViewModel model) { var redirectUrl = ""; if (!ModelState.IsValid) { redirectUrl = Url.Action("Index", "SignUp"); return(Json(new { MessageТype = MessageType.Error, Message = "Error" })); } byte[] salt; new RNGCryptoServiceProvider().GetBytes(salt = new byte[16]); var passwordEncryption = new PasswordEncription(); string encryptPassword = passwordEncryption.EncryptPassword(model.Password, "E546C8DF278CD5931069B522E695D4F2"); Users user = new Users(); user.Email = model.Email; user.Password = encryptPassword; user.Username = model.Username; user.Role = Roles.User; user.Salt = Encoding.UTF8.GetString(salt, 0, salt.Length); var userDb = db.Users.Where(x => x.Email == model.Email).FirstOrDefault(); if (userDb != null) { //throw an error } using (var db = new ApplicationDbContext()) { var users = db.Set <Users>(); users.Add(user); db.SaveChanges(); } return(Json(new { MessageТype = MessageType.Success, Message = "Success" })); }
public ViewModelLocator() { try { var config = new ConfigurationBuilder(); config.AddJsonFile(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + "\\autofac.json"); var module = new ConfigurationModule(config.Build()); var builder = new ContainerBuilder(); builder.RegisterModule(module); Container = builder.Build(); navigationService = Container.Resolve <INavigationService>(); appViewModel = Container.Resolve <AppViewModel>(); // SignUpViewModel = Container.Resolve <SignUpPageViewModel>(); LogInViewModel = Container.Resolve <LogInPageViewModel>(); MainViewModel = Container.Resolve <MainPageViewModel>(); NewTripViewModel = Container.Resolve <NewTripPageViewModel>(); ShowPdfViewModel = Container.Resolve <ShowPdfPageViewModel>(); ShowMapViewModel = Container.Resolve <ShowMapPageViewModel>(); ShowGoogleMapViewModel = Container.Resolve <ShowGoogleMapPageViewModel>(); navigationService.Register <LogInPageView>(LogInViewModel); navigationService.Register <SignUpPageView>(SignUpViewModel); navigationService.Register <MainPageView>(MainViewModel); navigationService.Register <NewTripPageView>(NewTripViewModel); navigationService.Register <ShowPdfPageView>(ShowPdfViewModel); navigationService.Register <ShowMapPageView>(ShowMapViewModel); navigationService.Register <ShowGoogleMapPageView>(ShowGoogleMapViewModel); navigationService.Navigate <LogInPageView>(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public SignUpPage() { InitializeComponent(); _viewModel = new SignUpPageViewModel(); }
protected override void OnAppearing() { base.OnAppearing(); BindingContext = new SignUpPageViewModel(Navigation); }
public SignUpPage(string emailAddress) { InitializeComponent(); BindingContext = new SignUpPageViewModel(emailAddress); }
public SignUpPage(string correo) { InitializeComponent(); BindingContext = new SignUpPageViewModel(); email.Text = correo; }
public SignUpPage() { InitializeComponent(); BindingContext = new SignUpPageViewModel(); }
public Page1(string userLogin) { InitializeComponent(); BindingContext = new SignUpPageViewModel(); EmailSignUp.Text = userLogin; }
public SignUpPage(SignUpPageViewModel vm) { this.Vm = vm; this.DataContext = vm; InitializeComponent(); }
public SignUpPage() { this.InitializeComponent(); ViewModel = (SignUpPageViewModel)DataContext; ViewModel.View = this; }
public SignUpPage(SignUpPageViewModel signUpPageViewModel) : base(signUpPageViewModel) { InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="SimpleSignUpPage" /> class. /// </summary> public SimpleSignUpPage() { InitializeComponent(); BindingContext = VM = new SignUpPageViewModel(Navigation); }
public SignupPage() { InitializeComponent(); BindingContext = new SignUpPageViewModel(this.Navigation); }
private void birthdayPicker_DateSelected(object sender, Syncfusion.XForms.Pickers.DateChangedEventArgs e) { SignUpPageViewModel vm = this.BindingContext as SignUpPageViewModel; BirthdayEntry.Text = ((DateTime)e.NewValue).ToShortDateString(); }
public SignUpPage(string emailparametroP) { InitializeComponent(); emailParametro2.Text = emailparametroP; BindingContext = new SignUpPageViewModel(); }