[identity] fix issues with capitalized usernames in users and reserved usernames tables
Summary:
we have to store usernames in their original form and in their lowercase form in these two dynamodb tables because we need case-insensitive uniqueness checks and case-sensitive retrievals. if a user registered with the username "ashoat," we should allow that user to log in with "Ashoat," too. however, we should not allow a different user to register the username "Ashoat."
searched for all places where we use USERS_TABLE_USERNAME_ATTRIBUTE or RESERVED_USERNAMES_TABLE_PARTITION_KEY and checked whether we were doing a retrieval or uniqueness check
if we were doing a uniqueness check, i swapped out the attribute with the lowercase equivalent. i made sure we always write the lowercase username to DDB along with the original username.
would normally add @bartek here but he's on vacation
Test Plan:
- registered username pamela
- tried logging in with capitalized Pamela -> succeeded
- tried registering a new user Pamela -> failed
- registered a new user KidRock directly with local keyserver
- tried to log in with usingCSAT=true and username kidrock -> succeeded
- registered a new user tommylee directly with local keyserver
- tried to log in with usingCSAT=true and username TommyLee -> succeeded
Reviewers: ashoat, will, tomek
Reviewed By: will
Subscribers: bartek
Differential Revision: https://phab.comm.dev/D12704