Fix login for short passwords

Fixes #4123