Adds login functionality and session setting