Fixed register flow, added js validation.

Still needs server-side validation beyond preventing duplicates.