launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23856
[Merge] lp:~cjwatson/launchpad/close-account-login-token into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/close-account-login-token into lp:launchpad.
Commit message:
Handle login tokens in close-account.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/close-account-login-token/+merge/371081
These otherwise block account closures when people have done something recently that required a login token to be generated, and I can't see a good reason to keep them.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/close-account-login-token into lp:launchpad.
=== modified file 'lib/lp/registry/scripts/closeaccount.py'
--- lib/lp/registry/scripts/closeaccount.py 2019-07-23 12:36:32 +0000
+++ lib/lp/registry/scripts/closeaccount.py 2019-08-08 11:38:32 +0000
@@ -256,6 +256,10 @@
# concerned with being removed from our systems.
('EmailAddress', 'person'),
+ # Login tokens are no longer interesting if the user can no longer
+ # log in.
+ ('LoginToken', 'requester'),
+
# Trash their codes of conduct and GPG keys
('SignedCodeOfConduct', 'owner'),
('GpgKey', 'owner'),
=== modified file 'lib/lp/registry/scripts/tests/test_closeaccount.py'
--- lib/lp/registry/scripts/tests/test_closeaccount.py 2019-07-23 12:36:32 +0000
+++ lib/lp/registry/scripts/tests/test_closeaccount.py 2019-08-08 11:38:32 +0000
@@ -47,6 +47,8 @@
DevNullLogger,
)
from lp.services.scripts.base import LaunchpadScriptFailure
+from lp.services.verification.interfaces.authtoken import LoginTokenType
+from lp.services.verification.interfaces.logintoken import ILoginTokenSet
from lp.soyuz.enums import (
ArchiveSubscriberStatus,
PackagePublishingStatus,
@@ -520,3 +522,21 @@
self.assertRemoved(account_id, person_id)
self.assertEqual(person, code_imports[0].registrant)
self.assertEqual(person, code_imports[1].registrant)
+
+ def test_handles_login_token(self):
+ person = self.factory.makePerson()
+ email = '%s@xxxxxxxxxxxxxxxxxxx' % person.name
+ login_token_set = getUtility(ILoginTokenSet)
+ token = login_token_set.new(
+ person, person.preferredemail.email, email,
+ LoginTokenType.VALIDATEEMAIL)
+ plaintext_token = token.token
+ self.assertEqual(token, login_token_set[plaintext_token])
+ person_id = person.id
+ account_id = person.account.id
+ script = self.makeScript([six.ensure_str(person.name)])
+ with dbuser('launchpad'):
+ self.runScript(script)
+ self.assertRemoved(account_id, person_id)
+ self.assertRaises(
+ KeyError, login_token_set.__getitem__, plaintext_token)
Follow ups