Wrote logic for login authentication