Beispiel #1
0
        public async Task <IActionResult> Register(AccountRegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new User {
                    FirstName = model.FirstName, Email = model.LoginEmail, UserName = model.LoginEmail
                };
                var result = await _securityAdapter.RegisterAsync(user, model.Password);

                if (result)
                {
                    await _securityAdapter.LoginAsync(model.LoginEmail, model.Password, false);

                    return(RedirectToAction(nameof(HomeController.Index), "Home"));
                }
            }
            return(View(model));
        }