updated login process to handle expired sessions