Handle login process for the front end