Wrox Programmer Forums
|
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 5th, 2009, 10:19 AM
Authorized User
 
Join Date: Sep 2009
Posts: 34
Thanks: 4
Thanked 1 Time in 1 Post
Default The forgot password doesn't work

On p. 122. ForgotPassword action resets the password independently from the answer.

It seems likely, that Memebership.Provider.ResetPassword(username, secretAnswer) doesn't take into account the secret answer at all!

Does anybody else experienced this error, and can propose a solution.

What if the user forgot the username and password?

It would be better to get the e-mail address from the user instead of user name.

Thanks

Gabriel
 
Old November 7th, 2009, 11:06 AM
Authorized User
 
Join Date: Sep 2009
Posts: 34
Thanks: 4
Thanked 1 Time in 1 Post
Default Nobody on theis issue?

Answer to my own question

The forgot password to work:

1. In the web.config file we would set the RequireQuestionAndAnswer=true

2. In the ForgotPassword action method we have to insert a Try/Catch:

if (!String.IsNullOrEmpty(secretAnswer))
{

try
{
string resetPassword = Membership.Provider.ResetPassword(userName, secretAnswer);
if (Membership.ValidateUser(userName, resetPassword))
{
FormsAuthentication.SetAuthCookie(userName, false);
return RedirectToAction("ChangePassword", new { resetPassword = resetPassword });
}
else
{
TempData["ErrorMessage"] = "Invalid Response";
return View();
}
}
catch (Exception ex)
{
TempData["ErrorMessage"] = ex.Message;
}
}

Last edited by Gabor66; November 7th, 2009 at 03:35 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
forgot sa password, unable to change... help happygv SQL Server 2000 14 April 29th, 2010 02:26 AM
FORGOT EXCEL PASSWORD prasanta2expert Excel VBA 4 March 17th, 2010 05:23 AM
Chapter 7 Email setting for "forgot password?" hdpark BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 10 April 23rd, 2008 02:48 PM
Forgot password for phpmyadmin AMP_Engineer BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 September 8th, 2004 04:59 AM
Forgot password? developerz BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 30th, 2003 04:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.