Reduce the handleRegister and handleLogin functions into one.

Use .bind to pass in parameter into the callback function.