Fixed Login Bug.

Added session and fixed logic. Login/logoff works correctly now.