-
Notifications
You must be signed in to change notification settings - Fork 4
History of the user model
The user model in the Tenant Platform, and its associated OnboardingInfo
model, are full of interesting edge cases, due to the unusual evolution of JustFix's product suite.
When the platform was first launched in October 2018, users could only create accounts and log in via a U.S. phone number--we never asked them for an email address.
Therefore, even though the default Django user model had an email address, we always left it blank.
Since the phone number was the primary way of identifying a user, we ended up creating a custom Django user model in #32 that was primarily identified by the user's phone number.
Django users also require usernames, but we never made users choose one themselves (it's an unnecessary piece of information to require them to add and remember, especially when the app has no social functionality). We ended up deciding to assign them a randomly generated username; see #341 for details on why that particular strategy was taken.
We also needed to store information that we asked users when they created an account: their address, housing type, and so forth. This information is stored in a separate one-to-one model with the user, called OnboardingInfo
. It exists for all users who created accounts on the Tenant Platform, but it does not necessarily exist for staff users who were created via manage.py createsuperuser
or manually through the Django admin.
Originally, the Tenant Platform also allowed users to log into the legacy JustFix.nyc tenant app if their phone number happened to match an existing account on it. This was done in #30 and #247.
At the time, any such legacy users effectively had "stub" accounts on the Tenant Platform that were largely empty (they didn't have OnboardingInfo
for instance). However, we (fortunately) don't have to worry about these users today, because when the legacy tenant app was decomissioned in Summer 2020 (see #1631), we deleted all such users, requiring them to create brand-new accounts on the tenant platform. Hooray for fewer edge cases!
With the onset of the Emergency HP Action (EHPA) tool in the spring of 2020, which allowed users to e-sign their HP Action forms via DocuSign, we needed to require users to have a valid email address. Thus we started actually populating the built-in Django user model's email
field by asking users for their email during onboarding, and we also added a step to the EHPA flow which asked them for their email if they were a legacy user who had never had the opportunity to give it to us.
We also required users to verify their email, and added a new is_email_verified
boolean to the user model to track this (see #1046 for more details).
Note also that for the next several months, an email address was required to create an account on our websites.
In the spring of 2020, we launched NoRent, which used the Tenant Platform's user database. However, unlike app.justfix.nyc, this new site supported users who lived anywhere in the United States! We ended up accounting for this in our schema by adding new fields to the OnboardingInfo
model, and making many of its NYC-specific fields optional. Full details about this change are documented in #1216.
However, aside from that, the onboarding of NYC users was different too. (NYC users were allowed to send NoRent letters for a short period of time, before we shut down access to them--see How Not To Do Rapid Response for more details on that.) In particular, we didn't ask users for their housing type, so even though they were NYC-based users, that particular field was left blank.
The other major aspect of the user model that NoRent affected was in regards to tracking whether users had actually agreed to the NoRent terms of service (ToS) versus the app.justfix.nyc ToS, as they were different. This was implemented in #1327.
The launch of Eviction Free NY in early 2021 didn't change our user model much.
We did relax the restriction of requiring an email address, making it only required when filing an EHPA (since it's required for e-signing). However, ultimately this still didn't change the variety of users in our database: we still had some who had blank email fields, and others who didn't.