refactor session management
refactor login to use common class