public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new Core.Models.ApplicationUser {
                    UserName = model.Email, Email = model.Email, Name = model.Name
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://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(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemple #2
0
 public System.Security.Claims.ClaimsIdentity CreateIdentity(Core.Models.ApplicationUser user, string p)
 {
     return(this.identityUserManager.CreateIdentity(new EFUser()
     {
         Id = user.Id, UserName = user.UserName
     }, p));
 }
Exemple #3
0
        public Core.Utilities.FuncResult Create(Core.Models.ApplicationUser user, string p)
        {
            var efUser = new EFUser()
            {
                UserName = user.UserName
            };
            var identityResult = this.identityUserManager.Create(efUser, p);

            user.Id = efUser.Id;
            return(new Core.Utilities.FuncResult()
            {
                Succeeded = identityResult.Succeeded, Errors = identityResult.Errors
            });
        }
Exemple #4
0
 public Task <System.Security.Claims.ClaimsIdentity> CreateIdentityAsync(Core.Models.ApplicationUser user, string p)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
        public Task <ClaimsIdentity> CreateIdentityAsync(Core.Models.ApplicationUser user, string p)
        {
            var identity = userRepository.CreateIdentityAsync(user, p);

            return(identity);
        }