public ActionResult VerifyEmail(UserEmailVerification model) { if (!string.IsNullOrEmpty(model.VerificationCode)) { if (_userLoginManager.VerifyAndUpdateUserEmail(model.UserLoginId, model.VerificationCode)) { var routeValues = new { area = "User" }; return RedirectToAction("Index", "Login", routeValues); } } model.ValidationError = Resources.MessageResources.EmailVerificationCodeIsInvalidMessage; return View(model); }
public ActionResult VerifyEmail(int id, string code) { object routeValues = new { area = "User" }; UserLogin userlogin = null; /// if user is authenticated if (User.Identity.IsAuthenticated) { return RedirectToAction("", "Profile", routeValues); } // if id is null or empty if (id <= 0) { return RedirectToAction("", "Login", routeValues); } userlogin = _userLoginManager.GetUserLogin(id); // if user login doesn't exists for given id if (userlogin == null) { return RedirectToAction("", "Login", routeValues); } var model = new UserEmailVerification(); if (userlogin.IsEmailVerified == true) { return RedirectToAction("", "Login", routeValues); } if (!string.IsNullOrEmpty(code)) { if (!_userLoginManager.VerifyAndUpdateUserEmail(id, code)) { model.ValidationError = Resources.MessageResources.EmailVerificationCodeIsInvalidMessage; } else { return RedirectToAction("", "Login", routeValues); } } model.UserLoginId = id; return View(model); }