Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account self-deletion #1225

Merged
merged 14 commits into from
Nov 25, 2024
Merged

Account self-deletion #1225

merged 14 commits into from
Nov 25, 2024

Conversation

jacbn
Copy link
Contributor

@jacbn jacbn commented Nov 13, 2024

Adds a new modal AccountSelfDeletionModal and new pages AccountDeletion (at /deleteaccount) and AccountDeletionSuccess (/deleteaccount/success) to manage the deletion flow.

Logging out still uses the old action/reducers rather than slices, and since new endpoints should be using slices, this unfortunately requires mixing the two. The slices in accountApi.ts supply the new interaction with the API, and logging out is managed through the changes in /state/actions/index.tsx. We cannot use the existing logout functionality as this redirects to / (see userConsistencyChecker), so we make a parallel a/r pair. This allows us to create our own redirect.

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 53.57143% with 39 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@567b7ef). Learn more about missing BASE report.
Report is 78 commits behind head on master.

Files with missing lines Patch % Lines
src/app/components/pages/AccountDeletion.tsx 48.48% 17 Missing ⚠️
src/app/state/actions/index.tsx 16.66% 5 Missing ⚠️
...rc/app/components/pages/AccountDeletionSuccess.tsx 50.00% 4 Missing ⚠️
...rc/app/state/middleware/userConsistencyChecker.tsx 0.00% 4 Missing ⚠️
src/app/state/slices/api/accountApi.ts 60.00% 4 Missing ⚠️
...omponents/elements/modals/AccountDeletionModal.tsx 66.66% 3 Missing ⚠️
src/app/components/elements/panels/UserProfile.tsx 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1225   +/-   ##
=========================================
  Coverage          ?   36.70%           
=========================================
  Files             ?      451           
  Lines             ?    19750           
  Branches          ?     6466           
=========================================
  Hits              ?     7250           
  Misses            ?    11855           
  Partials          ?      645           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Contributor

@sjd210 sjd210 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've a couple of small style thoughts, and then a slightly broader one about accessing the page with an invalid token/the wrong account.

Otherwise the changes look very good and the full through-line seems to work clearly and consistently.

<PageFragment fragmentId="account_deletion_final_warning" />
<p>Please select the reason for deleting your account:</p>
<DeletionReasonForm className="ms-2" deletionReason={deletionReason} setDeletionReason={setDeletionReason} />
<FormGroup check className="mt-4 ps-0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is causing the checkmark to be displayed outside of the checkbox. It looks very odd.

Is there a specific reason to include it that I'm missing? The only place we use it outside of this page is in RegistrationAgeCheck.tsx, but that's for a radio on which it doesn't seem to have any effect.

Suggested change
<FormGroup check className="mt-4 ps-0">
<FormGroup className="mt-4 ps-0">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this looks like a Firefox bug; something about the .tick class used in the checkbox being inline-block. I'm not convinced it needs the inline part anyway, as it's positioned by a flex container. I've made the tick display: block (and lengthened the short line by 1px... it was unbalanced 😣); this seems to fix the Firefox issue and I can't see any regressions elsewhere on any browser.

The check prop is used on all the checkbox examples on the RS docs, hence why I was a little cautious to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, I'm still not convinced that the check prop is necessary. It seems to just be used to add the form-check class to the component, the styling from which doesn't actually make a difference here.

That said, I agree it's working now and I can't find any other issues with checkboxes from that change, so let's stick with it.

Comment on lines 368 to 369
strong a, a strong {
color: $dark-pink-300 !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you've styled .btn.btn-inline-link essentially identically to a strong a now anyway, should we combine both of the css expressions in this file to the same line too? I think it's quite likely that any future changes would want to be applied to both now, since they're mostly the same thing.

Suggested change
strong a, a strong {
color: $dark-pink-300 !important;
strong a, a strong, .btn.btn-inline-link {
color: $dark-pink-300 !important;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good idea. There's also the content links on the line above this. Not quite sure the link ones belong in button.scss, but imo consistency is more important and combining them as you suggest guarantees that.


return <Container className="pb-5">
<TitleAndBreadcrumb currentPageTitle={siteSpecific("Account Deletion", "Account deletion")} className="mb-4" />
{!user ? <p>You must be logged in to delete your account.</p> :
Copy link
Contributor

@sjd210 sjd210 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this only checks for a logged-in user, it allows for an account other than the one being deleted to access this page. They won't then be able to actually delete the account because it's checked in the backend upon submitting the form (so it's not a security issue), but I could forsee this being confusing.

I'm particularly thinking about a case such as where they have multiple accounts and want to delete Account 1 and then log in with Account 2 because it is their new main account and THEN they click the link in the email. The page will show up as normal, but the deletion won't work.

I think that the page should either block a user from accessing it if they have a token which is invalid/expired for their account (so probably requiring an API interaction on page load) OR at least a confirmation of which account you're deleting somewhere on the page. Maybe both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We certainly shouldn't have an endpoint for checking if a token is valid, this would be a fairly major security concern... but we could use a separate token for validity and deletion, for example. We discussed this in the standup, and the conclusion was that given the token is only active for 24 hours and we believe the number of people who actively use two accounts is small, it isn't worth the extra effort to build anything now. There is ample opportunity throughout the process for them to contact us if something doesn't work so they should know to email us if this scenario occurs and deletion fails. It's a great thought though, and something to keep in mind if we see any tickets about it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I suppose that edge-case situation where this gets confusing isn't worse than our current situation of needing to manually process every delete request individually so there's no need to add extra complication (and I suppose the "HELLO <NAME>" in the nav-bar is still visible and should give some indication of which account you're logged into too, which should also help).

@sjd210 sjd210 merged commit 5bd1dad into master Nov 25, 2024
4 checks passed
@sjd210 sjd210 deleted the feature/account-self-deletion branch November 25, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants