Created backend logic for sign in