Made sure password resets force a password change

newpassword has to be set to a non-zero value to force the user to
change their password on login.

Addtionally some code styling fixes were made.