public ActionResult ForgotPassword(VerificationModel vModel) { if (ModelState.IsValid) { BUserProfile bUserProfile=new BUserProfile(); UserProfile userProfile = bUserProfile.GetSingle(vModel.Email); if (userProfile != null) { if (!string.IsNullOrEmpty(vModel.Email)) { string token = WebSecurity.GeneratePasswordResetToken(vModel.Email, 2880); //Send Email string body = string.Empty; using (StreamReader reader = new StreamReader(Server.MapPath("~/content/template/PasswordResetTemplate.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{USERNAME}",userProfile.FirstName +" "+ userProfile.LastName); body = body.Replace("{RESET_LINK}", "http://jobs.schoolgap.com/Account/PasswordReset?reset-id="+token); Notifications.Send(vModel.Email, "", "", "Password Reset Request", body, true); return RedirectToAction("ForgotPassword", "Account", new { sent = "1" }); } } } return View(); }
public ActionResult Resend(VerificationModel vModel) { if (ModelState.IsValid) { if (!WebSecurity.IsConfirmed(vModel.Email)) { Bwebpages_Membership bwebpagesMembership=new Bwebpages_Membership(); webpages_Membership webpagesMembership = bwebpagesMembership.GetSingle(vModel.Email); //Send Email string body = string.Empty; using (StreamReader reader = new StreamReader(Server.MapPath("~/content/template/ResendConfirmationTemplate.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{HREF}", "http://jobs.schoolgap.com/Account/Verify?cid=" + webpagesMembership.ConfirmationToken); Notifications.Send(vModel.Email, "", "", "Email Verification", body, true); return RedirectToAction("Resend", "Account", new {sent = "1"}); } else { ModelState.AddModelError("", "Invalid Email Address"); } } return View(); }