enhance auto login function, add log off function