Updated login code, added server-side validations for login