public ActionResult EmailRegister(UserProfile data) { if (ModelState.IsValid) { data.UserId = WebSecurity.CurrentUserId; data.UserName = WebSecurity.CurrentUserName; UserManager.AddEmail(data); string key = MyHelpers.Encode(data.Email); UserMailer.UserVerification(data, key).SendAsync(); return(View("EmailSent")); } return(RedirectToAction("EmailRegister")); }
/// <summary> /// Process the email verification method /// </summary> /// <param name="id">User id</param> /// <param name="token">Generated token</param> /// <returns></returns> public ActionResult EmailVerification(int id, string token) { var userprofile = UserManager.GetUserById(id); if (MyHelpers.Encode(userprofile.Email) == token) { UserManager.VerifyEmail(id); return(View("SuccessfulVerification")); } else { return(View("UnsuccessfulVerification")); } }