Use atexit to sleep

issue6651
review43321002
This commit is contained in:
Cédric Krier committed 2017-07-27 00:05:51 +02:00
1 parent 34df61d1aa
commit cdccc32a63
1 file changed
+2 -2
+2 -2
View File
@@ -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),