Use atexit to sleep
issue6651 review43321002
This commit is contained in:
1 parent
34df61d1aa
commit
cdccc32a63
1 file changed
+2
-2
@@ -168,7 +168,7 @@ class User(ModelSQL, ModelView):
|
||||
email = email.lower()
|
||||
|
||||
# Prevent brute force attack
|
||||
time.sleep(2 ** Attempt.count(email) - 1)
|
||||
Transaction().atexit(time.sleep, 2 ** Attempt.count(email) - 1)
|
||||
|
||||
users = cls.search([('email', '=', email)])
|
||||
if users:
|
||||
@@ -333,7 +333,7 @@ class User(ModelSQL, ModelView):
|
||||
email = email.lower()
|
||||
|
||||
# Prevent brute force attack
|
||||
time.sleep(2 ** Attempt.count(email) - 1)
|
||||
Transaction().atexit(time.sleep, 2 ** Attempt.count(email) - 1)
|
||||
|
||||
users = cls.search([
|
||||
('email', '=', email),
|
||||
|
||||
Reference in new issue
Block a user