Add login function and session management