public RegisterViewModel(ProjectControllerBase projectControllerBase, RegisterViewModel loginModel) : base(projectControllerBase) { Email = loginModel.Email; Password = loginModel.Password; ConfirmPassword = loginModel.ConfirmPassword; }
public ActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { var result = BusinessLogic.AccountProvider.RegisterWithEmail(CurrentUser.GuestID, model.Email, model.Password);// UserManager.Create(user, model.Password); if (result) { var accountID = BusinessLogic.AccountProvider.LoginWithEmail(model.Email, model.Password); CurrentUser = new SessionModule((int) accountID.Item1, accountID.Item2); //SignInManager.SignIn(user, false, false); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return RedirectToAction("Index", "Home"); } AddErrors(new[] { "Error register with email and password" }); } // If we got this far, something failed, redisplay form return View(model); }