Skip to content

Conversation

@ObadaS
Copy link
Collaborator

@ObadaS ObadaS commented Jan 9, 2025

Original PR : #1718 from @OhMaley

A brief description of the purpose of the changes contained in this PR.

Fixes some small issues seen after deploying the delete user feature.

It should fix the following problem:

  • email formatting
  • setting is_active to False on user deletion
  • hide deleted user on competition participant list + add an option to display them

Related PR

#1691 (original)
#1716 (for deployment)

Issues this PR resolves

#1159

Reminder on the hand testing checklist

  • Create a new user
  • Complete its profile with as much information as possible
  • Create an organization
  • Create a competition
  • Create a Queue
  • Add a submission
  • Make the competition and the submission public
  • Log out and log in with another user
  • Take a look at the new user profile
  • Log out and log in with the new user's account
  • Delete the account using the account view
  • Check your email (or the message in the console)
  • Click on the given link
  • Check that admins received an email with information on the user's deletion
  • Check the the deleted user's got a confirmation email
  • Try to log in with the deleted user's account. And fail
  • Log in as another user
  • Check that the competition and submissions of the removed user are still here but without personal data
  • Take a look at the removed user's profile and check that no personal information is displayed

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ObadaS
Copy link
Collaborator Author

ObadaS commented Jan 9, 2025

The email that is sent to administrators has the wrong username
image

@ObadaS
Copy link
Collaborator Author

ObadaS commented Jan 10, 2025

It seems like the link that the user gets to delete their accounts does not expire when clicked, which can then be used generate multiple emails sent to admins

@ihsaan-ullah
Copy link
Collaborator

The links in the deletion email are incomplete(e.g. competitions/345 instead of codabench.org/competitions/345)

Screenshot 2025-01-11 at 12 39 16 PM

@Didayolo
Copy link
Member

From Tristan:

Regarding the following points I have not developed them as it would require more time than I have as well as your opinions:

  • change the owner of a queue when the previous owner get his account removed
  • what to do regarding an organization when a user get his account removed. (in case he is the owner, in case he is the last member, in case he is part of an organization and in case the organization has made some submissions)

@OhMaley
Copy link
Collaborator

OhMaley commented Jan 14, 2025

It seems like the link that the user gets to delete their accounts does not expire when clicked, which can then be used generate multiple emails sent to admins

A very naive solution would be to add a check on the is_deleted attribute of the user in the /src/apps/profiles/views.py inside the delete method. This do not create the one time usage mechanism but it can avoid to trigger all the deletion mechanism.

If you want implement the one time usage feature it will probably requires a new model like TokenUsage whose going to be a oneToOne table between a user, a token with a is_used boolean. Some methods to generate a token and some lines of code to check and modify the is_used attribute. Something around those lines.

@OhMaley
Copy link
Collaborator

OhMaley commented Jan 14, 2025

The links in the deletion email are incomplete(e.g. competitions/345 instead of codabench.org/competitions/345)
Screenshot 2025-01-11 at 12 39 16 PM

Indeed it is missing the protocol and the domain in the url.

What we currently have: <a class="item" href="{% url 'profiles:organization_profile' pk=organization.id %}">
What we should have: <a class="item" href="{{ protocol }}://{{ domain }}{% url 'profiles:organization_profile' pk=organization.id %}">

We simply need to add protocol and doamin to the context passed down to the html template, as well as adding those in the html template

…erent deletion token to expire it after deletion, account deletion modal now disappears after clickin the delete my account button
@ihsaan-ullah
Copy link
Collaborator

With my latest commit, I have added the following updates:

  • restricted the usage of deletion link more than one time (if you delete your account, clicking the link will give you an error)
  • used a different deletion token like signup token that expires after account deletion
  • account deletion modal was not disappearing after clicking the Delete my account button, now it will disappear

@Didayolo Didayolo merged commit 8c82817 into develop Jan 16, 2025
1 check passed
@Didayolo Didayolo deleted the fix/remove-user/soft-removal branch January 16, 2025 14:29
Didayolo added a commit that referenced this pull request Jan 16, 2025
* Update version.json for release 1.15.0 (#1712)

* Merge develop into master (#1405)

* organization oidc login added

* unused test file removed

* http client

* some changes

* oidc login and signup added

* oidc flow completed

* Prevent LimitOverrunError with large output lines

If a submission writes a output line larger than the stream buffer
size ( default 64k ) a LimitOverrunError will be raise. Rather than
using readline(...) use readutil(....) and in the case of a overrun
just return the current buffer, the rest of the line will be returned
with the next read.

Signed-off-by: Chris Harris <cjh@lbl.gov>

* terms and condition check added

* one terms checkbox for all organization login buttons

* removed sandbox property from iframe to allow links in the iframe

* Detailed results title removed

* Detailed results configuration (#1374)

* competition model updated

* competition settings to allow participant to make submission public/private

* unwanted restriction removed

* detailed results now shown in submission panel and in leaderboard

* submission tests updated

---------

Signed-off-by: Chris Harris <cjh@lbl.gov>
Co-authored-by: Ihsan Ullah <ihsan2131@gmail.com>
Co-authored-by: Chris Harris <chris.harris@kitware.com>

* Revert "Merge develop into master (#1405)"

This reverts commit a26fc36.

* More general exception in views.py (#1512)

* More general exception in views.py

* Update views.py

* Update version.json for release 1.15.0

---------

Signed-off-by: Chris Harris <cjh@lbl.gov>
Co-authored-by: Adrien Pavão <adrien.pavao@gmail.com>
Co-authored-by: Ihsan Ullah <ihsanullah@Pixel-io.local>
Co-authored-by: Ihsan Ullah <ihsan2131@gmail.com>
Co-authored-by: Benjamin Bearce <bbearce@gmail.com>
Co-authored-by: Chris Harris <chris.harris@kitware.com>
Co-authored-by: Nicolas Homberg <nicomy_68@hotmail.fr>
Co-authored-by: GitHub Actions <actions@github.com>

* Feature/remove user/soft removal (#1691) (#1716)

* add soft deletions attributes in profile class + override deletion method + update email and log in mechanism

* add emails template + soft delete + account view + deletion confirmation view

* move the notice emails in the delete method of user

* filter deleted users out of the front page stat

* disable the action buttons on the list of participants modal in the competition management view

Co-authored-by: Tristan Mary <tristanmary2@gmail.com>

* Updated the filters to show the new "Is Deleted" (#1717)

* Updated the filters to show the new "Is Deleted"

* Flake8 fixes

---------

Co-authored-by: Obada Haddad <obada.haddad@lisn.fr>

* .gitingore update to ignore the home page counters file. Also removed the file from cache so that it's not tracked anymore

* Fix/remove user/soft removal (#1724)

* Set is_active to False when deleting a user

* change the email sending method and populate the missing txt files

* add a checkbox to show/hide deleted users in the list of participant modal

* Fixed the wrong user being named in the greetings in the email sent to admins upon account deletion

* Flake8 fixed

* restricted the usage of deletion link more than one time, used a different deletion token to expire it after deletion, account deletion modal now disappears after clickin the delete my account button

---------

Co-authored-by: OhMaley <tristanmary2@gmail.com>
Co-authored-by: Obada Haddad <obada.haddad@lisn.fr>
Co-authored-by: Ihsan Ullah <ihsan2131@gmail.com>

* Fix URLs in user deletion email (#1729)

* Fix URLs in user deletion email

* Fix domain

---------

Signed-off-by: Chris Harris <cjh@lbl.gov>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ihsan Ullah <ihsanullah@Pixel-io.local>
Co-authored-by: Ihsan Ullah <ihsan2131@gmail.com>
Co-authored-by: Benjamin Bearce <bbearce@gmail.com>
Co-authored-by: Chris Harris <chris.harris@kitware.com>
Co-authored-by: Nicolas Homberg <nicomy_68@hotmail.fr>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Tristan Mary <tristanmary2@gmail.com>
Co-authored-by: Obada Haddad-Soussac <11889208+ObadaS@users.noreply.github.com>
Co-authored-by: Obada Haddad <obada.haddad@lisn.fr>
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.

5 participants