Prevent fatal error on password reset. Fixes #2255

Credits @creativedutchmen.