Add support for redirecting legacy users to the legacy app #247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the complement to JustFixNYC/tenants#203, and fixes #78 by adding support for auto-logging-in legacy users to the legacy tenants' app and redirecting them there.
Currently it works like this:
When a user logs in to the new app, if they're not a "first-class" user (i.e. someone who registered on the new app), we'll check to see if they are a legacy user. If they are, we create a
LegacyUserInfo
record for them, migrate over their first and last name, and set a "prefers legacy app" flag for them (this flag can be changed through the Django admin interface, if we ever want to allow them to log into the new app without being forcibly redirected to the legacy one).Once login is successful, the front-end checks to see if the user has the "prefers legacy app" flag set. If they do, they are redirected to the legacy app by creating an
autologin
document in the legacy app's MongoDB instance and passing the key in the URL.To do