play-authenticate icon indicating copy to clipboard operation
play-authenticate copied to clipboard

NullPointerException when I try to reset my password

Open vmaubert opened this issue 11 years ago • 3 comments

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.

vmaubert avatar May 22 '14 14:05 vmaubert

+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.

gsprs avatar Nov 18 '16 21:11 gsprs

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.

Mule52 avatar Jan 11 '17 01:01 Mule52

The herokuapp version is really outdated - can you reproduce this with HEAD?

joscha avatar Jan 15 '17 22:01 joscha