Updated main.scpt with login

Added a new login mechanism with documented code comments.