public IActionResult Verify(string key, string hashtoken) { try { if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(hashtoken)) { var arrayVakue = SecurityTokenHelper.SplitToken(key); if (arrayVakue != null) { // arrayVakue[1] "UserId" var userId = Convert.ToInt64(arrayVakue[1]); var rvModel = _verificationQueries.GetResetGeneratedToken(userId); if (rvModel != null) { var result = SecurityTokenHelper.IsTokenValid(arrayVakue, hashtoken, rvModel.GeneratedToken); if (result == 1) { TempData["TokenMessage"] = "Sorry Verification Link Expired Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } if (result == 2) { TempData["TokenMessage"] = "Sorry Verification Link Expired Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } if (result == 0) { HttpContext.Session.SetString("VerificationUserId", arrayVakue[1]); HttpContext.Session.SetString("ActiveVerification", "1"); return(RedirectToAction("Reset", "ResetPassword")); } } } } } catch (Exception) { TempData["TokenMessage"] = "Sorry Verification Failed Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } TempData["TokenMessage"] = "Sorry Verification Failed Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); }
public IActionResult Verify(string key, string hashtoken) { try { if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(hashtoken)) { var arrayVakue = SecurityTokenHelper.SplitToken(key); if (arrayVakue != null) { // arrayVakue[1] "UserId" var userId = Convert.ToInt64(arrayVakue[1]); var rvModel = _verificationQueries.GetRegistrationGeneratedToken(userId); if (rvModel != null) { var result = SecurityTokenHelper.IsTokenValid(arrayVakue, hashtoken, rvModel.GeneratedToken); if (result == 1) { TempData["TokenErrorMessage"] = "Sorry Verification Link Expired Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } if (result == 2) { TempData["TokenErrorMessage"] = "Sorry Verification Link Expired Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } if (result == 0) { if (_verificationQueries.CheckIsAlreadyVerifiedRegistration(Convert.ToInt64(arrayVakue[1]))) { TempData["TokenErrorMessage"] = "Sorry Link Expired"; return(RedirectToAction("Login", "Portal")); } HttpContext.Session.SetString("VerificationUserId", arrayVakue[1]); var resetPasswordVerificationobj = _verificationQueries.GetRegistrationGeneratedToken(userId); _unitOfWorkEntityFramework.VerificationCommand.UpdateRegisterVerification(resetPasswordVerificationobj); var updateresult = _unitOfWorkEntityFramework.Commit(); if (updateresult) { TempData["Verify"] = "Done"; return(RedirectToAction("Completed", "VerifyRegistration")); } else { TempData["TokenErrorMessage"] = "Sorry Verification Failed Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } } } } } } catch (Exception) { TempData["TokenMessage"] = "Sorry Verification Failed Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); } TempData["TokenMessage"] = "Sorry Verification Failed Please request a new Verification link!"; return(RedirectToAction("Login", "Portal")); }