How to sent successful message after reset password link sent to email.
Hello everyone,
I have been working on the forgottenPassword almost 8 hours now but still no find solution to sent successful message after email sent the reset password link to customer email. I am trying to sent the message to display after email sent and redirect. I used Viewbag , TempData, Session , but no luck the value is always null, here is my code
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult HandleForgottenPassword(ForgottenPasswordViewModel model)
{
if (!ModelState.IsValid)
{
ModelState.AddModelError("ForgottenPasswordForm.", "No member found");
return PartialView("ForgottenPassword", model);
}
else
{
EmailHelper email = new EmailHelper();
email.SendResetPasswordEmail(findMember.Email,
expiryTime.ToString("ddMMyyyyHHmmssFFFF"));
TempData["Success"] = " A link to reset your password has been sent. Please Check your email."
There are a couple of different ways of returning an action result from inside a surface controller to take the user to an Umbraco Page.
They are
return CurrentUmbracoPage() this will display the current umbraco page with the modelstate in-tact, so if there is an error in ModelState, and you want to present the form again without wiping the rest of the form entries use that.(ie instead of where you return the PartialView on line 9 )
You can also redirect to a specific thank you page you've created in the cms, perhaps a child of the node the form is on, hidden from navigation ie
RedirectToUmbracoPage(nodeId) to take the user to a specific page by node Id
or as you are attempting above to redirect to the current page, clearing out the ModelState values using:
RedirectToCurrentUmbracoPage()
You should be able to add a message to TempData by using
TempData.Add("Success", "your form was successfully submitted");
and then display that message using
@TempData["Success"] in the template of the current page or page that your redirect to...
I can't see in the posted code above where you are writing out the TempData...??
How to sent successful message after reset password link sent to email.
Hello everyone,
I have been working on the forgottenPassword almost 8 hours now but still no find solution to sent successful message after email sent the reset password link to customer email. I am trying to sent the message to display after email sent and redirect. I used Viewbag , TempData, Session , but no luck the value is always null, here is my code
Hey MC
There are a couple of different ways of returning an action result from inside a surface controller to take the user to an Umbraco Page.
They are
return CurrentUmbracoPage() this will display the current umbraco page with the modelstate in-tact, so if there is an error in ModelState, and you want to present the form again without wiping the rest of the form entries use that.(ie instead of where you return the PartialView on line 9 )
You can also redirect to a specific thank you page you've created in the cms, perhaps a child of the node the form is on, hidden from navigation ie
RedirectToUmbracoPage(nodeId) to take the user to a specific page by node Id
or as you are attempting above to redirect to the current page, clearing out the ModelState values using:
RedirectToCurrentUmbracoPage()
You should be able to add a message to TempData by using
TempData.Add("Success", "your form was successfully submitted");
and then display that message using
@TempData["Success"] in the template of the current page or page that your redirect to...
I can't see in the posted code above where you are writing out the TempData...??
More info here:
http://our.umbraco.org/documentation/Reference/Mvc/forms
Hi Marc
Thank you for your time to explain to me , I am very appreciate your help its very helpful .
MC
is working on a reply...