Create a basic json structure containing a user object with a username and password. If login credentials match, go to the logged-in home page. If not, show an error and let them try again.
If they click register, show the register fields instead and pretend to log them in if their input is valid.