Fix some typos
Use .modal-form and wrap the entire dialog in a form.

This avoids needing onclick or anything which, for bonus points, makes
us CSP-friendly in the future.
Better error handling and avoid double-submits
Load up the profile when opening the dialog.
Check errors reported by sql.mit.edu.
Allow changing your profile
Close buttons aren't submit buttons.

Apparently "submit" is default?
Exit code 1 is still expected.
Tidy up alerts code.

Clear alerts. Also use jQuery since we have it available.
Less global stuff, more local