reorder the functions in login.js