mirror of
https://github.com/capricornxl/ad-password-self-service.git
synced 2025-08-11 16:20:10 +08:00
remove dependence redis-sever, now use mem storage
update to layui, support PC and Mobile html render
This commit is contained in:
@@ -7,13 +7,11 @@
|
||||
# @Date: 2021/5/20 8:47
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseRedirect
|
||||
import logging
|
||||
from utils.crypto_ops import Crypto
|
||||
from ldap3.core.exceptions import LDAPInvalidCredentialsResult, LDAPOperationResult, LDAPExceptionError, LDAPException
|
||||
|
||||
from ldap3.core.exceptions import LDAPException
|
||||
from django.conf import settings
|
||||
import os
|
||||
|
||||
APP_ENV = os.getenv('APP_ENV')
|
||||
if APP_ENV == 'dev':
|
||||
from conf.local_settings_dev import *
|
||||
@@ -38,19 +36,19 @@ def code_2_user_info_with_oauth2(ops, request, msg_template, home_url, code):
|
||||
_status, user_id = ops.get_user_id_by_code(code)
|
||||
# 判断 user_id 在本企业钉钉/微信中是否存在
|
||||
if not _status:
|
||||
context = {
|
||||
'msg': '获取userid失败,错误信息:{}'.format(user_id),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': '获取userid失败,错误信息:{}'.format(user_id),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return False, context, user_id
|
||||
detail_status, user_info = ops.get_user_detail_by_user_id(user_id)
|
||||
if not detail_status:
|
||||
context = {
|
||||
'msg': '获取用户信息失败,错误信息:{}'.format(user_info),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': '获取用户信息失败,错误信息:{}'.format(user_info),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return False, context, user_info
|
||||
return True, user_id, user_info
|
||||
|
||||
@@ -60,30 +58,30 @@ def ops_account(ad_ops, request, msg_template, home_url, username, new_password)
|
||||
ad 账号操作,判断账号状态,重置密码或解锁账号
|
||||
"""
|
||||
try:
|
||||
print("ops_account: {}" .format(username))
|
||||
print("ops_account: {}".format(username))
|
||||
_status, _account = ad_ops.ad_ensure_user_by_account(username=username)
|
||||
if not _status:
|
||||
context = {
|
||||
'msg': "账号[%s]在AD中不存在,请确认当前钉钉扫码账号绑定的邮箱是否和您正在使用的邮箱一致?或者该账号己被禁用!\n猜测:您的账号或邮箱是否是带有数字或其它字母区分?" % username,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "账号[%s]在AD中不存在,请确认当前钉钉扫码账号绑定的邮箱是否和您正在使用的邮箱一致?或者该账号己被禁用!\n猜测:您的账号或邮箱是否是带有数字或其它字母区分?" % username,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
_status, account_code = ad_ops.ad_get_user_status_by_account(username)
|
||||
if _status and account_code in settings.AD_ACCOUNT_DISABLE_CODE:
|
||||
context = {
|
||||
'msg': "此账号状态为己禁用,请联系HR确认账号是否正确。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "此账号状态为己禁用,请联系HR确认账号是否正确。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
elif not _status:
|
||||
context = {
|
||||
'msg': "错误:{}" .format(account_code),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "错误:{}".format(account_code),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
if new_password:
|
||||
@@ -92,38 +90,39 @@ def ops_account(ad_ops, request, msg_template, home_url, username, new_password)
|
||||
# 重置密码并执行一次解锁,防止重置后账号还是锁定状态。
|
||||
unlock_status, result = ad_ops.ad_unlock_user_by_account(username)
|
||||
if unlock_status:
|
||||
context = {
|
||||
'msg': "密码己修改成功,请妥善保管。你可以点击返回主页或直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "密码己修改成功,请妥善保管。你可以点击返回主页或直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "密码未修改/重置成功,错误信息:{}".format(result),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "密码未修改/重置成功,错误信息:{}".format(result),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
unlock_status, result = ad_ops.ad_unlock_user_by_account(username)
|
||||
if unlock_status:
|
||||
context = {
|
||||
'msg': "账号己解锁成功。你可以点击返回主页或直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "账号己解锁成功。你可以点击返回主页或直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "账号未能解锁,错误信息:{}".format(result),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "账号未能解锁,错误信息:{}".format(result),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except LDAPInvalidCredentialsResult as lic_e:
|
||||
raise LDAPOperationResult("LDAPInvalidCredentialsResult: " + str(lic_e.message))
|
||||
except LDAPOperationResult as lo_e:
|
||||
raise LDAPOperationResult("LDAPOperationResult: " + str(lo_e.message))
|
||||
except LDAPException as l_e:
|
||||
raise LDAPException("LDAPException: " + str(l_e))
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "账号未能解锁,错误信息:{}".format(l_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
@@ -9,25 +9,28 @@ from utils.format_username import format2username, get_user_is_active, get_email
|
||||
from .form import CheckForm
|
||||
from .utils import code_2_user_detail, ops_account
|
||||
from django.conf import settings
|
||||
|
||||
APP_ENV = os.getenv('APP_ENV')
|
||||
if APP_ENV == 'dev':
|
||||
from conf.local_settings_dev import AUTH_CODE_TYPE, DING_MO_APP_ID, WEWORK_CORP_ID, WEWORK_AGENT_ID, HOME_URL, DING_CORP_ID
|
||||
from conf.local_settings_dev import INTEGRATION_APP_TYPE, DING_MO_APP_ID, WEWORK_CORP_ID, WEWORK_AGENT_ID, HOME_URL, \
|
||||
DING_CORP_ID, TITLE
|
||||
else:
|
||||
from conf.local_settings import AUTH_CODE_TYPE, DING_MO_APP_ID, WEWORK_CORP_ID, WEWORK_AGENT_ID, HOME_URL, DING_CORP_ID
|
||||
from conf.local_settings import INTEGRATION_APP_TYPE, DING_MO_APP_ID, WEWORK_CORP_ID, WEWORK_AGENT_ID, HOME_URL, \
|
||||
DING_CORP_ID, TITLE
|
||||
|
||||
msg_template = 'messages.v1.html'
|
||||
msg_template = 'messages.html'
|
||||
logger = logging.getLogger('django')
|
||||
|
||||
|
||||
class PARAMS(object):
|
||||
if AUTH_CODE_TYPE == 'DING':
|
||||
if INTEGRATION_APP_TYPE == 'DING':
|
||||
corp_id = DING_CORP_ID
|
||||
app_id = DING_MO_APP_ID
|
||||
agent_id = None
|
||||
AUTH_APP = '钉钉'
|
||||
from utils.dingding_ops import DingDingOps
|
||||
ops = DingDingOps()
|
||||
elif AUTH_CODE_TYPE == 'WEWORK':
|
||||
elif INTEGRATION_APP_TYPE == 'WEWORK':
|
||||
corp_id = None
|
||||
app_id = WEWORK_CORP_ID
|
||||
agent_id = WEWORK_AGENT_ID
|
||||
@@ -51,16 +54,13 @@ def index(request):
|
||||
scan_app = scan_params.AUTH_APP
|
||||
unsecpwd = settings.UN_SEC_PASSWORD
|
||||
redirect_url = url_encode.quote(home_url + '/resetPassword')
|
||||
app_type = INTEGRATION_APP_TYPE
|
||||
global_title = TITLE
|
||||
|
||||
if request.method == 'GET' and AUTH_CODE_TYPE == 'DING':
|
||||
return render(request, 'ding_index.v1.html', locals())
|
||||
elif request.method == 'GET' and AUTH_CODE_TYPE == 'WEWORK':
|
||||
return render(request, 'we_index.v1.html', locals())
|
||||
if request.method == 'GET':
|
||||
return render(request, 'index.html', locals())
|
||||
else:
|
||||
logger.error('[异常] 请求方法:%s,请求路径%s' % (request.method, request.path))
|
||||
#
|
||||
# if request.method == 'GET':
|
||||
# return render(request, 'index.v1.html', locals())
|
||||
|
||||
if request.method == 'POST':
|
||||
# 对前端提交的数据进行二次验证,防止恶意提交简单密码或篡改账号。
|
||||
@@ -71,39 +71,39 @@ def index(request):
|
||||
old_password = form_obj.get("old_password")
|
||||
new_password = form_obj.get("new_password")
|
||||
else:
|
||||
_msg = check_form.as_p().errors
|
||||
_msg = check_form
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,错误信息:%s' % (request.method, request.path, _msg))
|
||||
context = {
|
||||
'msg': _msg,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': _msg,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
# 格式化用户名
|
||||
_, username = format2username(username)
|
||||
if _ is False:
|
||||
context = {
|
||||
'msg': username,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': username,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
# 检测账号状态
|
||||
auth_status, auth_result = AdOps().ad_auth_user(username=username, password=old_password)
|
||||
if not auth_status:
|
||||
context = {
|
||||
'msg': str(auth_result),
|
||||
'button_click': "window.history.back()",
|
||||
'button_display': "返回"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': str(auth_result),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
return ops_account(AdOps(), request, msg_template, home_url, username, new_password)
|
||||
else:
|
||||
context = {
|
||||
'msg': "请从主页进行修改密码操作或扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "请从主页进行修改密码操作或扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
@@ -115,100 +115,110 @@ def reset_password(request):
|
||||
"""
|
||||
home_url = '%s://%s' % (request.scheme, HOME_URL)
|
||||
if request.method == 'GET':
|
||||
code = request.GET.get('code')
|
||||
if code:
|
||||
logger.info('[成功] 请求方法:%s,请求路径:%s,Code:%s' % (request.method, request.path, code))
|
||||
code = request.GET.get('code', None)
|
||||
username = request.GET.get('username', None)
|
||||
# 如果满足,说明已经授权免密登录
|
||||
if username and code and request.session.get(username) == code:
|
||||
context = {'global_title': TITLE,
|
||||
'username': username,
|
||||
'code': code,
|
||||
}
|
||||
return render(request, 'reset_password.html', context)
|
||||
else:
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到Code。' % (request.method, request.path))
|
||||
context = {
|
||||
'msg': "错误,临时授权码己失效,请从主页重新开始登录授权..",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
try:
|
||||
# 用code换取用户基本信息
|
||||
_status, user_id, user_info = code_2_user_detail(_ops, home_url, code)
|
||||
if not _status:
|
||||
return render(request, msg_template, user_id)
|
||||
# 账号在企业微信或钉钉中是否是激活的
|
||||
_, res = get_user_is_active(user_info)
|
||||
if not _:
|
||||
context = {
|
||||
'msg': '当前扫码的用户未激活或可能己离职,用户信息如下:%s' % user_info,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
if code:
|
||||
logger.info('[成功] 请求方法:%s,请求路径:%s,Code:%s' % (request.method, request.path, code))
|
||||
else:
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到Code。' % (request.method, request.path))
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "错误,临时授权码己失效,请从主页重新开始登录授权..",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
try:
|
||||
# 用code换取用户基本信息
|
||||
_status, user_id, user_info = code_2_user_detail(_ops, home_url, code)
|
||||
if not _status:
|
||||
return render(request, msg_template, user_id)
|
||||
# 账号在企业微信或钉钉中是否是激活的
|
||||
_, res = get_user_is_active(user_info)
|
||||
if not _:
|
||||
context = {'global_title': TITLE,
|
||||
'msg': '当前扫码的用户未激活或可能己离职,用户信息如下:%s' % user_info,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except Exception as callback_e:
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "错误[%s],请与管理员联系." % str(callback_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
logger.error('[异常] :%s' % str(callback_e))
|
||||
return render(request, msg_template, context)
|
||||
except Exception as callback_e:
|
||||
context = {
|
||||
'msg': "错误[%s],请与管理员联系." % str(callback_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
logger.error('[异常] :%s' % str(callback_e))
|
||||
return render(request, msg_template, context)
|
||||
|
||||
# 通过user_info拿到用户邮箱,并格式化为username
|
||||
_, email = get_email_from_userinfo(user_info)
|
||||
if not _:
|
||||
context = {
|
||||
'msg': email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
# 通过user_info拿到用户邮箱,并格式化为username
|
||||
_, email = get_email_from_userinfo(user_info)
|
||||
if not _:
|
||||
context = {'global_title': TITLE,
|
||||
'msg': email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
_, username = format2username(email)
|
||||
if _ is False:
|
||||
context = {
|
||||
'msg': username,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
_, username = format2username(email)
|
||||
if _ is False:
|
||||
context = {'global_title': TITLE,
|
||||
'msg': username,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
# 如果邮箱能提取到,则格式化之后,提取出账号提交到前端绑定
|
||||
if username:
|
||||
request.session[username] = code
|
||||
context = {
|
||||
'username': username,
|
||||
'code': code,
|
||||
}
|
||||
return render(request, 'resetPassword.v1.html', context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "{},您好,企业{}中未能找到您账号的邮箱配置,请联系HR完善信息。".format(user_info.get('name'), scan_params.AUTH_APP),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
# 如果邮箱能提取到,则格式化之后,提取出账号提交到前端绑定
|
||||
if username:
|
||||
request.session[username] = code
|
||||
context = {'global_title': TITLE,
|
||||
'username': username,
|
||||
'code': code,
|
||||
}
|
||||
return render(request, 'reset_password.html', context)
|
||||
else:
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "{},您好,企业{}中未能找到您账号的邮箱配置,请联系HR完善信息。".format(
|
||||
user_info.get('name'), scan_params.AUTH_APP),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
# 重置密码页面,输入新密码后点击提交
|
||||
elif request.method == 'POST':
|
||||
username = request.POST.get('username')
|
||||
code = request.POST.get('code')
|
||||
if request.session.get(username) and request.session.get(username) == code:
|
||||
if code and request.session.get(username) == code:
|
||||
_new_password = request.POST.get('new_password').strip()
|
||||
try:
|
||||
return ops_account(ad_ops=AdOps(), request=request, msg_template=msg_template, home_url=home_url, username=username, new_password=_new_password)
|
||||
return ops_account(ad_ops=AdOps(), request=request, msg_template=msg_template, home_url=home_url,
|
||||
username=username, new_password=_new_password)
|
||||
except Exception as reset_e:
|
||||
context = {
|
||||
'msg': "错误[%s],请与管理员联系." % str(reset_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "错误[%s],请与管理员联系." % str(reset_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
logger.error('[异常] :%s' % str(reset_e))
|
||||
return render(request, msg_template, context)
|
||||
finally:
|
||||
del request.session[username]
|
||||
else:
|
||||
context = {
|
||||
'msg': "认证已经失效,请从主页重新进行操作。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "认证已经失效,请从主页重新进行操作。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
@@ -220,6 +230,23 @@ def unlock_account(request):
|
||||
"""
|
||||
home_url = '%s://%s' % (request.scheme, HOME_URL)
|
||||
|
||||
if request.method == 'GET':
|
||||
code = request.GET.get('code')
|
||||
username = request.GET.get('username')
|
||||
if code and request.session.get(username) == code:
|
||||
context = {'global_title': TITLE,
|
||||
'username': username,
|
||||
'code': code,
|
||||
}
|
||||
return render(request, 'unlock.html', context)
|
||||
else:
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "{},您好,当前会话可能已经过期,请再试一次吧。".format(username),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
if request.method == 'POST':
|
||||
username = request.POST.get('username')
|
||||
code = request.POST.get('code')
|
||||
@@ -227,21 +254,21 @@ def unlock_account(request):
|
||||
try:
|
||||
return ops_account(AdOps(), request, msg_template, home_url, username, None)
|
||||
except Exception as reset_e:
|
||||
context = {
|
||||
'msg': "错误[%s],请与管理员联系." % str(reset_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "错误[%s],请与管理员联系." % str(reset_e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
logger.error('[异常] :%s' % str(reset_e))
|
||||
return render(request, msg_template, context)
|
||||
finally:
|
||||
del request.session[username]
|
||||
else:
|
||||
context = {
|
||||
'msg': "认证已经失效,请从主页重新进行操作。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': "认证已经失效,请从主页重新进行操作。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
@@ -249,9 +276,9 @@ def messages(request):
|
||||
_msg = request.GET.get('msg')
|
||||
button_click = request.GET.get('button_click')
|
||||
button_display = request.GET.get('button_display')
|
||||
context = {
|
||||
'msg': _msg,
|
||||
'button_click': button_click,
|
||||
'button_display': button_display
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': _msg,
|
||||
'button_click': button_click,
|
||||
'button_display': button_display
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
Reference in New Issue
Block a user