Completed solution for user login