fixed bug where login function was not authenticating before looking for sessions