Ejemplo n.º 1
0
        public async Task<ActionResult> SetEmail(SetEmailViewModel model)
        {
            if (ModelState.IsValid)
            {
                var uId = User.GetUserId();
                var result = await UserManager.SetEmailAsync(uId, model.Email);
                if (result.Succeeded)
                {
                    var user = await UserManager.FindByIdAsync(uId);
                    if (user != null)
                    {
                        await SignInAsync(user, isPersistent: false);
                    }
                    return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess });
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Ejemplo n.º 2
0
 //
 // GET: /Manage/SetEmail
 public ActionResult SetEmail()
 {
     SetEmailViewModel model = new SetEmailViewModel();
     var uId = User.GetUserId();
     var user = UserManager.FindById(uId);
     model.Email = user.Email;
     return View(model);
 }