Fix a couple typos in registration JS
Refactor methods to other scripts
Fix error in csrfToken element