From c036843f940a65999b71cd4f177bf8ca305fb451 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 7 Jul 2022 12:57:25 +0200 Subject: [PATCH 1/2] misc: add Lock.lock_identifier method (#65412) --- src/authentic2/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/authentic2/models.py b/src/authentic2/models.py index 41487c26..f6bfdb32 100644 --- a/src/authentic2/models.py +++ b/src/authentic2/models.py @@ -600,6 +600,10 @@ class Lock(models.Model): def lock_email(cls, email, nowait=False): cls.lock('email:%s' % email, nowait=nowait) + @classmethod + def lock_identifier(cls, identifier, nowait=False): + cls.lock('identifier:%s' % identifier, nowait=nowait) + class Meta: verbose_name = _('Lock') verbose_name_plural = _('Lock') -- 2.35.1