Page MenuHomePhabricator

[native] add back password input for account deletion
ClosedPublic

Authored by varun on Jun 5 2024, 9:55 PM.
Tags
None
Referenced Files
F3495409: D12326.diff
Thu, Dec 19, 8:32 AM
Unknown Object (File)
Wed, Dec 18, 7:30 AM
Unknown Object (File)
Wed, Dec 18, 7:30 AM
Unknown Object (File)
Wed, Dec 18, 7:30 AM
Unknown Object (File)
Wed, Dec 18, 7:30 AM
Unknown Object (File)
Wed, Dec 18, 7:30 AM
Unknown Object (File)
Wed, Dec 18, 7:30 AM
Unknown Object (File)
Sat, Nov 23, 10:30 AM
Subscribers

Details

Summary

as per the white paper, we will require password users to enter their password in order to delete their account.

Depends on D12325

Test Plan
  1. usingCommServicesAccessToken = false; no change to the UI
  2. usingCommServicesAccessToken = true, password user; prompted for password, if incorrect, identity account deletion fails and alert is displayed, but user is not logged out. if correct, account successfully deleted and user is logged out
  3. usingCommServicesAccessToken = true, wallet user; no change to the UI, account deletion successful
  4. usingCommServicesAccessToken = true, password user, keyserver offline; prompted for password, if correct identity account deletion succeeds but keyserver account deletion fails. user is logged out and deleteAccountActionTypes.success is dispatched

Simulator Screenshot - iPhone 15 Pro Max - 2024-06-06 at 01.01.02.png (2×1 px, 234 KB)

Simulator Screenshot - iPhone 15 Pro Max - 2024-06-06 at 01.00.48.png (2×1 px, 144 KB)

Diff Detail

Repository
rCOMM Comm
Branch
delete
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

varun published this revision for review.Jun 5 2024, 10:08 PM
varun planned changes to this revision.

improve UX if identity account deletion fails

fix error handling and ordering in useDeleteAccount

fix regression when usingCSAT is false

varun added subscribers: kamil, inka.

adding @inka as a blocking reviewer

referenced this commit for the UI changes: https://github.com/CommE2E/comm/commit/ba9a43c03a7c0f95ba7c71963452b2c98c0e9e8c?diff=split&w=0

lib/actions/user-actions.js
335

we await this promise first to make sure that the user isn't logged out if identity account deletion fails. callKeyserverDeleteAccount below calls setNewSession if it succeeds, which logs the user out

336–356

if usingCSAT and keyserver account deletion fails, we should still dispatch deleteAccountActionTypes.success. otherwise, the user would be visibly logged in but unable to connect to a keyserver since they wouldn't have any keys in DynamoDB

keyservers will have "zombie" accounts if keyserver account deletion fails but identity account deletion succeeds. we'll need some way to clean them up. this might be handled by ENG-7838 or ENG-5918 (cc @kamil )

349–351

in the pre-usingCSAT world, we don't want to dispatch deleteAccountActionTypes.success if keyserver account deletion fails

lib/actions/user-actions.js
357–363

it seems like the only reducer that checks the payload on deleteAccountActionTypes.success is reduceCurrentUserInfo, which sets currentUserInfo in redux to the value of currentUserInfo in the payload if it's different than the existing state. i think setting it to null is correct, but want to double check (cc @tomek, @inka )

ashoat added inline comments.
lib/actions/user-actions.js
317–335

There's really no point to declaring this IIFE

358

This changed but I think it's okay

native/profile/delete-account.react.js
92

We never capitalize like this. It should always be "Password required".

But separately, can we make the error cases and language match what we had previously?

inka added inline comments.
lib/actions/user-actions.js
317–335

@ashoat in your code we call both await identityClient.deletePasswordUser(password); and await identityClient.deleteWalletUser(); in case of a password user, I don't think that's right.

This revision is now accepted and ready to land.Jun 7 2024, 6:36 AM
lib/actions/user-actions.js
317–335

Right, I missed a return after the await identityClient.deletePasswordUser(password)

lib/actions/user-actions.js
317–335

I don't think we want to return after the await identityClient.deletePasswordUser(password), but I think I understand your general feedback about not using an IIFE

native/profile/delete-account.react.js
132 ↗(On Diff #41117)

Realized we're missing autoCapitalize="none" here, can you add it in a follow-up diff?