implemented logic for login