Improved login handling

Signed-off-by: themuntdregger <themuntdregger@gmail.com>