Fix roles on user registration.

We were storing the role in the database incorrectly and not correctly
creating the :roles set in the authentications.
Merge pull request #450 from MastodonC/feature/fix-user-registration

Fix roles on user registration.
Fix editing of devices

- Store location as stringified json
- Add schema check to devices.
- Add tests and fix privacy checkbox.
Formatting as per @otfrom's comment.