Updated login logic for unauthorized user