url-encode username passed to login-uri after failure
fix potential NPE introduced in previous commit