//[ValidateAntiForgeryToken] public async Task <ActionResult> Register(RegisterCustomerViewModel model) { if (ModelState.IsValid) { #region Check for duplicate username or email if (UserRepo.UserNameExists(model.PhoneNumber)) { ModelState.AddModelError("", Resources.Resource.PhoneNumberExists); return(View(model)); } if (UserRepo.EmailExists(model.Email)) { ModelState.AddModelError("", Resources.Resource.EmailExists); return(View(model)); } #endregion var user = new User { UserName = model.PhoneNumber, PhoneNumber = model.PhoneNumber, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName }; UserRepo.CreateUser(user, model.Password); if (user.Id != null) { // Add Customer Role UserRepo.AddUserRole(user.Id, StaticVariables.CustomerRoleId); // Add Customer var customer = new Core.Models.Customer() { UserId = user.Id, IsDeleted = false }; UserRepo.AddCustomer(customer); //await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); // For more information on how to enable Auth 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", "Auth", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your Auth", "Please confirm your Auth by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("Login", "Auth")); } } // If we got this far, something failed, redisplay form return(View(model)); }