Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password Reset not working #79

Closed
brandtam opened this issue May 28, 2013 · 16 comments
Closed

Password Reset not working #79

brandtam opened this issue May 28, 2013 · 16 comments

Comments

@brandtam
Copy link

I'm not sure if this is related to L4 update today (because I didn't try it before today) but when I try and use the Forgot Password link it sends the email just fine but when I use the link that is emailed to me to reset the password there is a problem. It looks like the token isn't making it into the controller. Here is a screenie.
screen shot 2013-05-28 at 3 00 45 pm

@andrew13
Copy link
Collaborator

Thanks!

@cie101
Copy link

cie101 commented May 29, 2013

brandtam did this commit fix it for you?

@brandtam
Copy link
Author

Hmmm Actually it did not fix my issue. It seems that the controller is still not able to access $token. It looks like it's not able to access the token being passed in the url that is being generated in the forgot password email. Here are some details.
screen shot 2013-05-28 at 10 37 58 pm
screen shot 2013-05-28 at 10 38 19 pm
screen shot 2013-05-28 at 10 38 31 pm

@brandtam
Copy link
Author

And I did run composer update beforehand :-D

@cie101
Copy link

cie101 commented May 29, 2013

Brandtam re run php artisan confide:routes he added two routes to the restful controller that fixes it. But I no long get this error now I just get invalid password everytime I try to change the password

@brandtam
Copy link
Author

Thanks cie101 that did fix the routes. After I deleted the user controller and recreated it using -restful...

However, now I'm stuck where you are with the password not being accepted. I looked in the confide controller and I can confirm that the $input array is making it through with the token, the password and the password confirmation fields. But it looks like the method is just not doing the right thing with the passwords.

I think a new issue should be opened at this point.

@andrew13
Copy link
Collaborator

Password reset still doesn't work. Next step

@andrew13 andrew13 reopened this May 30, 2013
@Zizaco
Copy link
Owner

Zizaco commented May 31, 2013

38569f1 does fixes this, I believe.

@brandtam, Let me know if you still getting any issue.

@Zizaco Zizaco closed this as completed May 31, 2013
@cie101
Copy link

cie101 commented May 31, 2013

In regards the the routes that were added it breaks the the confirm password link. Once you create a user and get the email saying click link to confirm the user get the screenshot that brandtam posted above. I removed those routes from my routes.php and in the UserController.php in the postReset() method i created a $token variable and told it to also get the token input. Then i went ahead and in the line where it says $return Redirect::to('user/reset') i changed that to Redirect::to('user/reset/' . $token) and that fixed the issue of the confirmation link not working.

@Zizaco
Copy link
Owner

Zizaco commented May 31, 2013

@cie101, are you using the password reset link that was sent to the user email?

The password reset link should look like the following: http://localhost:3000/user/reset_password/334f1f52c23f425aa1040f60aa0d3e77

The last parameter is the $token. You should strictly provide a $token to the password reset route. You cannot access it like http://localhost:3000/user/reset_password

Are you sure that the link in the email was absent of the token?

@cie101
Copy link

cie101 commented May 31, 2013

@Zizaco the link shows the token, but when it was erroring before that it gave the screenshot before it would redirect you to /user/reset, but it would not include the token. Lets say that a password tried to get reset now and it failed validation it would get a redirect to /user/reset without the token. The only way it passed the token is by using the routes that @andrew13 added or by including it in the controller like i did.

The only issue i have with the routes that were added to the routes.php is that when you create a user and click on the generated link for whatever reason it errors out with the same error as the screenshot above. Thats when i added it in the controller and it is all working now. I don't know if maybe someone else can reproduce the issue with the routes that @andrew13 added to the routes.php to confirm.

@Zizaco
Copy link
Owner

Zizaco commented May 31, 2013

Does this #87 solves your problem? There was an error in RESTful routes, are you using a generated RESTful controller?

@cie101
Copy link

cie101 commented May 31, 2013

@Zizaco 87 solved the original issue i am now able to reset the password and all is good, but when you click on the link once you get the confirm email it just takes you to the same error thats in the screenshot above. Let me try to reproduce the issue again. I am going to remove the token variable that i put in the controller and put back the routes that @andrew13 added. I am using RESTful controller. and the Restful routes.

@andrew13
Copy link
Collaborator

I think what is happening is if the reset token fails. The redirect is incorrect. No token is passed on the redirect. From controller.blade.php, function do_reset_password or postReset

        else
        {
            $error_msg = Lang::get('confide::confide.alerts.wrong_password_reset');
            @if (! $restful)
            return Redirect::action('{{ $name }}@reset_password', array('token'=>$input['token']))
            @else
            return Redirect::to('user/reset/'.$input['token'])
            @endif
                ->withInput()
                ->with( 'error', $error_msg );
        }

@Zizaco
Copy link
Owner

Zizaco commented May 31, 2013

@andrew13 Thats right. Thanks

f565ef3 should fix this

@Zizaco Zizaco reopened this May 31, 2013
@Zizaco Zizaco closed this as completed May 31, 2013
@cie101
Copy link

cie101 commented May 31, 2013

@Zizaco Did you remove the route generation that @andrew13 added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants