mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-23 09:11:15 +00:00
make PASSWORD_RESET_TIMEOUT_DAYS default 3
This commit is contained in:
parent
d5636f28ce
commit
ed9eee950f
@ -1,11 +1,11 @@
|
|||||||
# Copyright (c) 2012-2016 Seafile Ltd.
|
# Copyright (c) 2012-2016 Seafile Ltd.
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.http import int_to_base36, base36_to_int
|
from django.utils.http import int_to_base36, base36_to_int
|
||||||
from django.utils.crypto import constant_time_compare, salted_hmac
|
from django.utils.crypto import constant_time_compare, salted_hmac
|
||||||
import six
|
import six
|
||||||
from seahub.base.models import UserLastLogin
|
from seahub.base.models import UserLastLogin
|
||||||
|
|
||||||
|
|
||||||
class PasswordResetTokenGenerator(object):
|
class PasswordResetTokenGenerator(object):
|
||||||
"""
|
"""
|
||||||
Strategy object used to generate and check tokens for the password
|
Strategy object used to generate and check tokens for the password
|
||||||
@ -38,7 +38,7 @@ class PasswordResetTokenGenerator(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Check the timestamp is within limit
|
# Check the timestamp is within limit
|
||||||
if (self._num_days(self._today()) - ts) > settings.PASSWORD_RESET_TIMEOUT_DAYS:
|
if (self._num_days(self._today()) - ts) > 3:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -77,4 +77,5 @@ class PasswordResetTokenGenerator(object):
|
|||||||
# Used for mocking in tests
|
# Used for mocking in tests
|
||||||
return date.today()
|
return date.today()
|
||||||
|
|
||||||
|
|
||||||
default_token_generator = PasswordResetTokenGenerator()
|
default_token_generator = PasswordResetTokenGenerator()
|
||||||
|
Loading…
Reference in New Issue
Block a user