Add link to registration from login screen
Legacy API credentials will continue to work for now

Add a note to the legacy account upgrade screen informing the user that
their legacy credentials will continue to work for the time being.
Add link to registration on the homepage
Fix site not found 404 page

This page was giving an error when accessed because the authorization
middleware wasn't being loaded early enough so the 'userCan' helper
wasn't available in the template. To avoid this I've moved the auth
middleware up the stack so it's already done when the instanceSelector
runs.

This has required a small change to the deserializeUser method so that
it doesn't depend on 'req.popit' being available, since the
instanceSelector middleware is now run after the auth.
Prevent basic auth login appearing when creating user

This was trying to authenticate with basic auth, even if the user was
already authenticated with a cookie.
Add post-registration email

Send the user an email with some useful links after they have signed up.
check if existing user already has access to instance

if the user already has access to the instance then we don't want to add
a duplicate permission so check and display a message if that's the
case.
Do not issue a new invite if there is an existing one
allow invites to be resent

turn invited 'button' into a dropdown with confirmation that then
resends the existing invite. refactor out the invite send code a
little to prevent duplication
Add authorization to person and organization apps
Update copy for new auth pages

Also includes a change to the admin app which includes the name of the
user sending the invite in the email.
Fix legacy upgrade with missing instance

If the user is trying to upgrade their account and for some reason the
instance has been deleted in the meantime then we simply redirect to the
main listing of instances.
Add hashes to JS and CSS files for cache invalidation

Only do it for JS on production as requirejs makes this hard on
development and it shouldn't really be needed there either.

When I say it makes it hard I mean that because it's requesting lots of
files and then using the path of those files as the module name putting
in place the code to resolve this is both painfully manual and hence
error prone and also problematic because of the way require handles
fetching. Given cache busting is only really an issue with production
deployment it's not worth the pain.

For #554
Remove primary membership fields from the view

These fields have caused confusion as they don't get populated
automatically when entering data via the API and they don't work
properly when only adding a place and not a constituency.
Remove logic for processing primary memberships

This slightly confusing logic tried to find an existing organization
which the primary membership was referring to, and if it didn't exist it
created it. This is no longer needed because we're removing the concept
of primary membership.
Simplify membership removal javascript

We no longer need to worry about the primary membership being recreated,
so we can simplify the javascript which handles this.
Only name field is required for completed header

When the name field has been filled in we display the header which
allows the user to save and add another person.
remove entity-save-changes class from person submit button

the enter-to-save augmenter triggers a click on anything with a class of
entity-save-changes when you hit enter in an input box. If the submit
button has this class then it means there are two items with that class
on the page which means that sometimes the form is submitted twice. This
can cause multiple memberships to be added.

Fixes #599
allow memberships to be deleted and added at same time

If you added a new membership to a person then the list of ids passed to
the nin query would include an undefinded entry. As all the membership
id of a person were not undefined this would result in the query
never selecting any documents. We now filter out any undefineds from the
id list to prevent this.

Fixes #600