Example #1
0
        public async Task <IActionResult> Register(RegisteryViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser()
                {
                    UserName = model.Email, Email = model.Email
                };
                var result = await userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var pass = new AuthenticationProperties();
                    pass.Items.Add("Password", model.Password);

                    logger.LogInformation("User created a new account with password");
                    await signInManager.SignInAsync(user, pass);

                    logger.LogInformation("Use created a new account with password");

                    await PreaperWalletForNewUser(model.Email);

                    return(RedirectToLocal(returnUrl));
                }
                AddErrors(result);
            }
            return(View(model));
        }
Example #2
0
        //private readonly ICommand _navigateToUsers;

        public RegisterCommand(AuthenticationStore authenticationStore, RegisteryViewModel registeryViewModel /*, ICommand navigateToUsers*/)
        {
            _authenticationStore = authenticationStore;
            _registeryViewModel  = registeryViewModel;
            //_navigateToUsers = navigateToUsers;
        }