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
remove guest editing from codebase

now that we have can have multiple users per insance it no longer makes
sense to have guest logins

Fixes #577
initial token based api authentication

still needs to check if the permission for the token holder is valid for
the operation
basic api key management

page on hosting app to request and remove an api key.
use roles for api auth

and correctly handle the fact that legacy users do not have roles or
permissions
Update to latest version of popit-api

This includes the fix for dropping the elasticsearch index before doing
a reindex.
Don't redirect to homepage after resetting password

On the live site the homepage redirects to popit.poplus.org, which is
confusing to users who have just reset their password.
Update popit-api

This includes a fix for an invalid callback in the reindex method.
Allow the reindex script to take and instance slug

Rather than reindexing all databases, if you give it an instance slug it
will just reindex the given instance.
Add script for importing an instance from JSON