コード例 #1
0
 public FluentValidationPage()
 {
     InitializeComponent();
     _viewModel            = new SignUpPageViewModel();
     BindingContext        = _viewModel;
     finishButton.Clicked += async(s, e) => await Navigation.PopModalAsync();
 }
コード例 #2
0
 public SignUpPage()
 {
     InitializeComponent();
     _viewModel = BindingContext as SignUpPageViewModel;
     ConfirmPasswordEntry.Unfocused   += ConfirmPasswordEntry_Unfocused;;
     ConfirmPasswordEntry.TextChanged += ConfirmPasswordEntry_TextChanged;;
 }
コード例 #3
0
        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();
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
ファイル: SignUpPage.xaml.cs プロジェクト: zeeshan323gb/ByMe
 public SignUpPage()
 {
     InitializeComponent();
     viewModel      = App.Locator.SignUp;
     BindingContext = viewModel;
     // btnSubmit.Clicked += BtnSubmit_Clicked;
     Title = "SignUp";
 }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
        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 }));
        }
コード例 #8
0
 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;
 }
コード例 #9
0
        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);
        }
コード例 #10
0
ファイル: SignUpPage.xaml.cs プロジェクト: sky365365/NtMiner
 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);
 }
コード例 #11
0
        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);
            //};
        }
コード例 #12
0
        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);
            }
        }
コード例 #13
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);
        }
コード例 #14
0
        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" }));
        }
コード例 #15
0
        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);
            }
        }
コード例 #16
0
 public SignUpPage()
 {
     InitializeComponent();
     _viewModel = new SignUpPageViewModel();
 }
コード例 #17
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = new SignUpPageViewModel(Navigation);
        }
 public SignUpPage(string emailAddress)
 {
     InitializeComponent();
     BindingContext = new SignUpPageViewModel(emailAddress);
 }
コード例 #19
0
 public SignUpPage(string correo)
 {
     InitializeComponent();
     BindingContext = new SignUpPageViewModel();
     email.Text     = correo;
 }
コード例 #20
0
 public SignUpPage()
 {
     InitializeComponent();
     BindingContext = new SignUpPageViewModel();
 }
コード例 #21
0
 public Page1(string userLogin)
 {
     InitializeComponent();
     BindingContext   = new SignUpPageViewModel();
     EmailSignUp.Text = userLogin;
 }
コード例 #22
0
ファイル: SignUpPage.xaml.cs プロジェクト: sky365365/NtMiner
 public SignUpPage(SignUpPageViewModel vm)
 {
     this.Vm          = vm;
     this.DataContext = vm;
     InitializeComponent();
 }
コード例 #23
0
 public SignUpPage()
 {
     this.InitializeComponent();
     ViewModel      = (SignUpPageViewModel)DataContext;
     ViewModel.View = this;
 }
コード例 #24
0
 public SignUpPage(SignUpPageViewModel signUpPageViewModel) : base(signUpPageViewModel)
 {
     InitializeComponent();
 }
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleSignUpPage" /> class.
 /// </summary>
 public SimpleSignUpPage()
 {
     InitializeComponent();
     BindingContext = VM = new SignUpPageViewModel(Navigation);
 }
コード例 #26
0
 public SignupPage()
 {
     InitializeComponent();
     BindingContext = new SignUpPageViewModel(this.Navigation);
 }
コード例 #27
0
ファイル: SignUpPage.xaml.cs プロジェクト: eahs/FBLASocialApp
        private void birthdayPicker_DateSelected(object sender, Syncfusion.XForms.Pickers.DateChangedEventArgs e)
        {
            SignUpPageViewModel vm = this.BindingContext as SignUpPageViewModel;

            BirthdayEntry.Text = ((DateTime)e.NewValue).ToShortDateString();
        }
コード例 #28
0
 public SignUpPage(string emailparametroP)
 {
     InitializeComponent();
     emailParametro2.Text = emailparametroP;
     BindingContext       = new SignUpPageViewModel();
 }