added some needed authorization & authentication code; login now works where previously it didn't when creating a new user