1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 02:42:47 +00:00

[share] Add setting for share link audit code timeout

This commit is contained in:
zhengxie
2017-10-11 10:09:03 +08:00
parent 674a150fc8
commit 46c4b490b6
2 changed files with 6 additions and 3 deletions

View File

@@ -287,6 +287,9 @@ SHARE_LINK_PASSWORD_MIN_LENGTH = 8
# enable or disable share link audit
ENABLE_SHARE_LINK_AUDIT = False
# share link audit code timeout
SHARE_LINK_AUDIT_CODE_TIMEOUT = 60 * 60
# enable or disable limit ip
ENABLE_LIMIT_IPADDRESS = False
TRUSTED_IP_LIST = ['127.0.0.1']

View File

@@ -32,7 +32,8 @@ from seahub.utils import string2list, gen_shared_link, \
gen_token, normalize_cache_key
from seahub.utils.mail import send_html_email_with_dj_template, MAIL_PRIORITY
from seahub.settings import SITE_ROOT, REPLACE_FROM_EMAIL, \
ADD_REPLY_TO_HEADER, SHARE_LINK_EMAIL_LANGUAGE
ADD_REPLY_TO_HEADER, SHARE_LINK_EMAIL_LANGUAGE, \
SHARE_LINK_AUDIT_CODE_TIMEOUT
from seahub.profile.models import Profile
# Get an instance of a logger
@@ -451,9 +452,8 @@ def ajax_get_link_audit_code(request):
}), status=400, content_type=content_type)
cache_key = normalize_cache_key(email, 'share_link_audit_')
timeout = 60 * 60 # one hour
code = gen_token(max_length=6)
cache.set(cache_key, code, timeout)
cache.set(cache_key, code, SHARE_LINK_AUDIT_CODE_TIMEOUT)
# send code to user via email
subject = _("Verification code for visiting share links")