play-authenticate
play-authenticate copied to clipboard
NullPointerException when I try to reset my password
Hi,
I found a NPE with your demo (https://play-authenticate.herokuapp.com/).
- Sign up with a Google account
- In your profile, verify your mail
- Look your inbox and verify your mail
- Sign out
- Use "Forgot your password?"
- Look your inbox and reset your password
- An error occurred !
Good luck and thx for your great work.
+1 I use the demo to build my project and the forgot password feature is giving the NPE. I am not able to understand why and would really appreciate some help.
I believe the issue is within https://github.com/joscha/play-authenticate/blob/master/samples/java/play-authenticate-usage/app/views/main.scala.html. The @user.name fails because userProvider.getUser(session()) is null. Your code should check for null first, rather than assume this is always valid and call @user.name.
To understand why, debug one line at a time in the sample. I started with what I was passing into my @main(userProvider, ...) in password_reset.scala.html (or whatever yours is called), and mine is different than the sample. I had code in main.scala.html relying on userProvider being valid (not null). Try commenting out the line that has @user.name and tell me if it still blows up. Add an @if(userProvider.getUser(session()) != null){ to surround that entire code block in main.scala.html, or something to that effect.
The herokuapp version is really outdated - can you reproduce this with HEAD?