Fixed invalid login handling
Merge branch 'master' into user_session