[#307] Fix middleware domain resolution

When running a partner site on a sub-sub-domain like
akvo.localdev.akvoapp.org the construction of request.app_domain
doesn't resolve correctly, the "tertiary" domain gets lost. Fix by
changing how the slicing of the domain parts list is made.
Merge branch 'develop' of github.com:akvo/akvo-rsr into develop
[#307] Fix register link on partner sites sign in page

Also change the password reset link on the same page to use a context
variable to resolve the URL.