remove dependence redis-sever, now use mem storage
update to layui, support PC and Mobile html render
This commit is contained in:
parent
d10601b9ab
commit
b82f2ececb
|
@ -155,9 +155,13 @@ else
|
|||
else
|
||||
echo "脚本目录下没有发现Python${PYTHON_VER}.tar.xz,将会下载python ${PYTHON_VER}"
|
||||
sudo wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tar.xz
|
||||
if [[ $? -eq 0 ]]; then
|
||||
tar xf Python-${PYTHON_VER}.tar.xz
|
||||
cd Python-${PYTHON_VER}
|
||||
sudo ./configure --prefix=${PYTHON_INSTALL_DIR} && make && make install
|
||||
else
|
||||
echo "下载${PYTHON_VER}/Python-${PYTHON_VER}.tar.xz失败,请重新运行本脚本再次重试"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]
|
||||
|
@ -178,6 +182,20 @@ else
|
|||
fi
|
||||
|
||||
|
||||
yum install -y redis
|
||||
if [[ $? -eq 0 ]]; then
|
||||
gen_password=$(echo "$(hostname)$(date)" |base64)
|
||||
sed -i 's@^requirepass.*@@g' /etc/redis.conf
|
||||
sed -i "/# requirepass foobared/a requirepass ${gen_password}" /etc/redis.conf
|
||||
systemctl restart redis
|
||||
sed -i "s@REDIS_PASSWORD.*@REDIS_PASSWORD = r'${gen_password}'@g" ${SHELL_FOLDER}/conf/local_settings.py
|
||||
echo "安装 redis-server 成功"
|
||||
echo "Redis Server密码是:${gen_password},可在/etc/redis.conf中查到"
|
||||
else
|
||||
echo "安装 redis-server 失败,请重新运行本脚本再试"
|
||||
fi
|
||||
|
||||
|
||||
##修改PIP源为国内
|
||||
mkdir -p ~/.pip
|
||||
cat << EOF > ~/.pip/pip.conf
|
||||
|
|
|
@ -29,7 +29,7 @@ AD_CONN_PORT = 636
|
|||
# 验证的类型
|
||||
# 钉钉 / 企业微信,自行修改
|
||||
# 值是:DING / WEWORK
|
||||
AUTH_CODE_TYPE = 'DING'
|
||||
INTEGRATION_APP_TYPE = 'WEWORK'
|
||||
|
||||
# ########## 钉钉 《如果不使用钉钉,可不用配置》##########
|
||||
# 钉钉企业ID <CorpId>,修改为自己的
|
||||
|
@ -54,7 +54,7 @@ WEWORK_AGENT_ID = r'修改为自己的'
|
|||
WEWORK_AGNET_SECRET = r'修改为自己的'
|
||||
|
||||
# Redis配置
|
||||
# redis的连接地址,redis://<Ip/Host>:<Port>/<数据库>
|
||||
# redis的连接地址,redis://<Ip/Host>:<Port>
|
||||
REDIS_LOCATION = r'redis://127.0.0.1:6379'
|
||||
REDIS_PASSWORD = r'修改为自己的'
|
||||
|
||||
|
@ -62,3 +62,5 @@ REDIS_PASSWORD = r'修改为自己的'
|
|||
# 主页域名,钉钉跳转等需要指定域名,格式:pwd.abc.com。
|
||||
# 如果是自定义安装,请修改成自己的域名
|
||||
HOME_URL = 'PWD_SELF_SERVICE_DOMAIN'
|
||||
# 标题
|
||||
TITLE = 'Self-Service'
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
import sys
|
||||
|
||||
from django_redis import get_redis_connection
|
||||
from utils.storage.kvstorage import KvStorage
|
||||
import datetime
|
||||
from utils.storage.memorystorage import MemoryStorage
|
||||
from traceback import format_exc
|
||||
|
||||
|
||||
try:
|
||||
redis_conn = get_redis_connection()
|
||||
cache_storage = KvStorage(redis_conn)
|
||||
cache_storage.set('redis_connection', str(datetime.datetime.now()))
|
||||
redis_get = cache_storage.get('redis_connection')
|
||||
cache_storage = MemoryStorage()
|
||||
cache_storage.set('MemoryStorage', str(datetime.datetime.now()))
|
||||
redis_get = cache_storage.get('MemoryStorage')
|
||||
except Exception as e:
|
||||
print("请排查Redis配置,错误信息如下:")
|
||||
print("Redis Exception: {}".format(format_exc()))
|
||||
print("MemoryStorage Exception: {}".format(format_exc()))
|
||||
sys.exit(1)
|
||||
|
|
|
@ -2,10 +2,8 @@ import os
|
|||
|
||||
APP_ENV = os.getenv('APP_ENV')
|
||||
if APP_ENV == 'dev':
|
||||
from conf.local_settings_dev import REDIS_PASSWORD, REDIS_LOCATION
|
||||
DEBUG = True
|
||||
else:
|
||||
from conf.local_settings import REDIS_PASSWORD, REDIS_LOCATION
|
||||
DEBUG = False
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
|
@ -80,13 +78,9 @@ SESSION_COOKIE_AGE = 300
|
|||
# False 会话cookie可以在用户浏览器中保持有效期。True:关闭浏览器,则Cookie失效。
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||
# session使用的存储方式
|
||||
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
|
||||
# 指明使用哪一个库保存session数据
|
||||
SESSION_CACHE_ALIAS = "session"
|
||||
|
||||
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
|
||||
|
||||
INSTALLED_APPS = [
|
||||
# 'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
|
@ -95,6 +89,13 @@ INSTALLED_APPS = [
|
|||
'resetpwd',
|
||||
]
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': 'unique-snowflake',
|
||||
}
|
||||
}
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
|
@ -130,27 +131,6 @@ WSGI_APPLICATION = 'pwdselfservice.wsgi.application'
|
|||
# 可能不是太准确,如果使用者能确定还有其它状态码,可以自行在此处添加
|
||||
AD_ACCOUNT_DISABLE_CODE = [514, 66050]
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": "{}/1".format(REDIS_LOCATION),
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
"PASSWORD": REDIS_PASSWORD,
|
||||
"IGNORE_EXCEPTIONS": True,
|
||||
}
|
||||
},
|
||||
"session": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": "{}/3".format(REDIS_LOCATION), # 指明使用redis的3号数据库
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
"PASSWORD": REDIS_PASSWORD,
|
||||
"IGNORE_EXCEPTIONS": True,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,379 +0,0 @@
|
|||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
background: #f6f5f7;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: -20px 0 50px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
letter-spacing: .5px;
|
||||
margin: 20px 0 30px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
text-decoration: none;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.head-container {
|
||||
background: url(/static/img/logo.png) left center no-repeat;
|
||||
overflow: hidden;
|
||||
width: 768px;
|
||||
max-width: 100%;
|
||||
height: 100px;
|
||||
max-height: 100px;
|
||||
color: #1b83d8;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
.head-container p {
|
||||
float: right;
|
||||
margin-top: 28px;
|
||||
padding: 10px 30px;
|
||||
font-size: 28px;
|
||||
vertical-align: middle;
|
||||
text-shadow: 0 14px 28px rgba(0, 0, 0, .25), 0 5px 5px rgba(0, 0, 0, .22);
|
||||
}
|
||||
|
||||
.middle-container {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 14px 28px rgba(0, 0, 0, .25), 0 10px 10px rgba(0, 0, 0, .22);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 768px;
|
||||
max-width: 100%;
|
||||
min-height: 480px;
|
||||
}
|
||||
|
||||
|
||||
.form-container form {
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 50px;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
.form-container a {
|
||||
border-radius: 20px;
|
||||
border: 1px solid #1b83d8;
|
||||
background: #1b83d8;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 12px 45px;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
transition: transform 80ms ease-in;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-container a:active {
|
||||
transform: scale(.95);
|
||||
}
|
||||
|
||||
.form-container a:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.form-container a.ghost {
|
||||
background: transparent;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
.social-container {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.social-container a {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 50%;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0 5px;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.social-container a:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.form-container input {
|
||||
background: #eee;
|
||||
border: none;
|
||||
padding: 12px 15px;
|
||||
margin: 8px 0;
|
||||
width: 100%;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 20px;
|
||||
border: 1px solid #1b83d8;
|
||||
background: #1b83d8;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 12px 45px;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
transition: transform 80ms ease-in;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:active {
|
||||
transform: scale(.95);
|
||||
}
|
||||
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button.ghost {
|
||||
background: transparent;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.form-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
transition: all .6s ease-in-out;
|
||||
}
|
||||
|
||||
.left-content-container {
|
||||
left: 0;
|
||||
width: 50%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.right-content-container {
|
||||
left: 0;
|
||||
width: 50%;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.overlay-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
transition: transform .6s ease-in-out;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
background: #41aaff;
|
||||
background: linear-gradient(to right, #1b83d8, #6ebbfa) no-repeat 0 0 / cover;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
left: -100%;
|
||||
height: 100%;
|
||||
width: 200%;
|
||||
transform: translateY(0);
|
||||
transition: transform .6s ease-in-out;
|
||||
}
|
||||
|
||||
.overlay-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 40px;
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
transform: translateY(0);
|
||||
transition: transform .6s ease-in-out;
|
||||
}
|
||||
|
||||
|
||||
.overlay-container a {
|
||||
border-radius: 20px;
|
||||
border: 1px solid #1b83d8;
|
||||
background: #1b83d8;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 12px 45px;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
transition: transform 80ms ease-in;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.overlay-container a:active {
|
||||
transform: scale(.95);
|
||||
}
|
||||
|
||||
.overlay-container a:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.overlay-container a.ghost {
|
||||
background: transparent;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.overlay-right {
|
||||
right: 0;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.overlay-left {
|
||||
transform: translateY(-20%);
|
||||
}
|
||||
|
||||
/* Move signin to right */
|
||||
.middle-container.right-panel-active .left-content-container {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
/* Move overlay to left */
|
||||
.middle-container.right-panel-active .overlay-container {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
/* Bring signup over signin */
|
||||
.middle-container.right-panel-active .right-content-container {
|
||||
transform: translateX(100%);
|
||||
opacity: 1;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
/* Move overlay back to right */
|
||||
.middle-container.right-panel-active .overlay {
|
||||
transform: translateX(50%);
|
||||
}
|
||||
|
||||
/* Bring back the text to center */
|
||||
.middle-container.right-panel-active .overlay-left {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* Same effect for right */
|
||||
.middle-container.right-panel-active .overlay-right {
|
||||
transform: translateY(20%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
.sk-fading-circle {
|
||||
margin: 100px auto;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sk-fading-circle .sk-circle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.sk-fading-circle .sk-circle:before {
|
||||
content: '';
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
width: 15%;
|
||||
height: 15%;
|
||||
background-color: #333;
|
||||
border-radius: 100%;
|
||||
-webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
||||
animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
||||
}
|
||||
.sk-fading-circle .sk-circle2 {
|
||||
-webkit-transform: rotate(30deg);
|
||||
-ms-transform: rotate(30deg);
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle3 {
|
||||
-webkit-transform: rotate(60deg);
|
||||
-ms-transform: rotate(60deg);
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle4 {
|
||||
-webkit-transform: rotate(90deg);
|
||||
-ms-transform: rotate(90deg);
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle5 {
|
||||
-webkit-transform: rotate(120deg);
|
||||
-ms-transform: rotate(120deg);
|
||||
transform: rotate(120deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle6 {
|
||||
-webkit-transform: rotate(150deg);
|
||||
-ms-transform: rotate(150deg);
|
||||
transform: rotate(150deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle7 {
|
||||
-webkit-transform: rotate(180deg);
|
||||
-ms-transform: rotate(180deg);
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle8 {
|
||||
-webkit-transform: rotate(210deg);
|
||||
-ms-transform: rotate(210deg);
|
||||
transform: rotate(210deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle9 {
|
||||
-webkit-transform: rotate(240deg);
|
||||
-ms-transform: rotate(240deg);
|
||||
transform: rotate(240deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle10 {
|
||||
-webkit-transform: rotate(270deg);
|
||||
-ms-transform: rotate(270deg);
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle11 {
|
||||
-webkit-transform: rotate(300deg);
|
||||
-ms-transform: rotate(300deg);
|
||||
transform: rotate(300deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle12 {
|
||||
-webkit-transform: rotate(330deg);
|
||||
-ms-transform: rotate(330deg);
|
||||
transform: rotate(330deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle2:before {
|
||||
-webkit-animation-delay: -1.1s;
|
||||
animation-delay: -1.1s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle3:before {
|
||||
-webkit-animation-delay: -1s;
|
||||
animation-delay: -1s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle4:before {
|
||||
-webkit-animation-delay: -0.9s;
|
||||
animation-delay: -0.9s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle5:before {
|
||||
-webkit-animation-delay: -0.8s;
|
||||
animation-delay: -0.8s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle6:before {
|
||||
-webkit-animation-delay: -0.7s;
|
||||
animation-delay: -0.7s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle7:before {
|
||||
-webkit-animation-delay: -0.6s;
|
||||
animation-delay: -0.6s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle8:before {
|
||||
-webkit-animation-delay: -0.5s;
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle9:before {
|
||||
-webkit-animation-delay: -0.4s;
|
||||
animation-delay: -0.4s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle10:before {
|
||||
-webkit-animation-delay: -0.3s;
|
||||
animation-delay: -0.3s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle11:before {
|
||||
-webkit-animation-delay: -0.2s;
|
||||
animation-delay: -0.2s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle12:before {
|
||||
-webkit-animation-delay: -0.1s;
|
||||
animation-delay: -0.1s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes sk-circleFadeDelay {
|
||||
0%, 39%, 100% { opacity: 0; }
|
||||
40% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes sk-circleFadeDelay {
|
||||
0%, 39%, 100% { opacity: 0; }
|
||||
40% { opacity: 1; }
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
a, body, button, dd, div, dl, dt, h1, h2, h3, h4, h5, h6, input, li, ol, p, td, textarea, ul { margin: 0; padding: 0; }
|
||||
body, button, input, select, textarea { font: 9pt/1.5 tahoma,arial,Hiragino Sans GB,\5b8b\4f53,sans-serif; }
|
||||
button, h1, h2, h3, h4, h5, h6, input, select, textarea { font-size: 100%; }
|
||||
/*background-image: linear-gradient(160deg, #2f548e 20%,#043559 80%);*/
|
||||
html{height: 100%; background-image: linear-gradient(160deg, #2f548e 20%,#043559 80%);}
|
||||
ol, ul { list-style: none;}
|
||||
a { color: #666; text-decoration: none; }
|
||||
a:hover { color: #043559; text-decoration: underline; }
|
||||
body { font-size: 9pt; height: 100%;
|
||||
font-family: 'microsoft yahei', sans-serif; min-width: 750pt; margin: 0; overflow: hidden}
|
||||
img { border: 0; vertical-align: top; }
|
||||
textarea { resize: none; }
|
||||
a, button, input, select, textarea { outline: 0; }
|
||||
a, button { cursor: pointer; }
|
||||
button { border: none; }
|
||||
.errorlist {font-size: 16px; color: #333333}
|
||||
.pagewrap {height: 100% }
|
||||
.main { position: relative; margin-top:0; width: 100%; height: 100%}
|
||||
.header {height: 100px;margin-bottom: 5%;margin-left: 50px; background: url(/static/img/logo.png) left center no-repeat; }
|
||||
.header h1 a { display: block; }
|
||||
.content { overflow: hidden; margin-left: 10% }
|
||||
.content .con_left { float: left; height: 450px; width: 50%; margin-top: 65px}
|
||||
/*.content .con_left .box {position: absolute; width: 400px; height:400px; left: 50%; right: 50%; margin-left: -100px; margin-right: -100px;}*/
|
||||
.content .con_left p { padding: 0 0 3px; width: 10pc; color: #040000; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_left a { padding: 0 0 0 2pc; color: #2f548e; text-decoration: underline; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_right { float: left; margin: 65px 0 0; width: 28pc; height: 450px; border: 1px solid #dedede; background: #fff; }
|
||||
.content .con_right .con_r_top { padding: 0 0 0 39px; width: 409px; height: 110px; border-top: 8px solid #2e558e; }
|
||||
.content .con_right .con_r_top .left, .content .con_right .con_r_top .right { float: left; padding: 35px 0 0; width: 186px; height: 35px; text-align: center; text-decoration: none; font-size: 18px; font-family: "微软雅黑"; }
|
||||
.content .con_right .con_r_top .left { border-bottom: 2px solid #dedede; color: #999; }
|
||||
.content .con_right ul .con_r_left .erweima { text-align: center; }
|
||||
.content .con_right ul .con_r_left p {color: #2f548e; font-size: 25px; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_right ul .con_r_left .user input { margin: 0 0 21px -1px; padding-left: 7px; width: 324px; height: 33px; border: 1px solid #dedede; color: #999; font-size: 14px; font-family: "微软雅黑"; line-height: 2pc; }
|
||||
.content .con_right ul .con_r_left .user { padding: 0 0 0 39px; }
|
||||
.content .con_right ul .con_r_left .user ul{font-size: 16px; color: #333333}
|
||||
.content .con_right ul .con_r_left .user li{font-size: 16px; color: #333333}
|
||||
.content .con_right ul .con_r_left .user .user-icon { float: left; width: 36px; height: 35px; background: url(../img/user-icon.jpg) left top no-repeat; }
|
||||
.content .con_right ul .con_r_left .user .mima-icon { float: left; width: 36px; height: 35px; background: url(../img/mima-icon.jpg) left top no-repeat; }
|
||||
.content .con_right ul .con_r_left .user .unlock-icon { float: left; width: 36px; height: 35px; background: url(../img/unlock.jpg) left top no-repeat; }
|
||||
.content .con_right ul .con_r_left p { overflow: hidden; padding: 0 39px 37px; color: #666; font-size: 13px; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_right ul .con_r_left p .mima { float: left; padding-left: 5px; text-decoration: none; }
|
||||
.content .con_right ul .con_r_left p .zhuce { float: right; text-decoration: none; }
|
||||
.content .con_right ul .con_r_left button { margin: 0 0 0 75pt; width: 250px; height: 44px; background: #2e558e; color: #fff; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_right .con_r_top .right { border-bottom: 2px solid #2e558e; color: #333; }
|
||||
.content .con_right ul .con_r_right .user input { margin: 0 0 21px -1px; padding-left: 7px; width: 324px; height: 33px; border: 1px solid #dedede; color: #999; font-size: 14px; font-family: "微软雅黑"; line-height: 2pc; }
|
||||
.content .con_right ul .con_r_right .user { padding: 0 0 0 39px; }
|
||||
.content .con_right ul .con_r_right .user ul{font-size: 16px; color: #333333}
|
||||
.content .con_right ul .con_r_right .user li{font-size: 16px; color: #333333}
|
||||
.content .con_right ul .con_r_right .user .user-icon { float: left; width: 36px; height: 35px; background: url(../img/user-icon.jpg) left top no-repeat; }
|
||||
.content .con_right ul .con_r_right .user .mima-icon { float: left; width: 36px; height: 35px; background: url(../img/mima-icon.jpg) left top no-repeat; }
|
||||
.content .con_right ul .con_r_right .user .unlock-icon { float: left; width: 36px; height: 35px; background: url(../img/unlock.jpg) left top no-repeat; }
|
||||
.content .con_right ul .con_r_right p { overflow: hidden; padding: 0 39px 37px; color: #666; font-size: 13px; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_right ul .con_r_right p .mima { float: left; padding-left: 5px; text-decoration: none; }
|
||||
.content .con_right ul .con_r_right p .zhuce { float: right; text-decoration: none; }
|
||||
.content .con_right ul .con_r_right button { margin: 0 0 0 75pt; width: 250px; height: 44px; background: #2e558e; color: #fff; font-size: 1pc; font-family: 'microsoft yahei', sans-serif; }
|
||||
.content .con_right ul .con_r_left { display: none; }
|
||||
.con_right ul .con_r_left .erweima { position: relative; margin: 0 auto; width: 365px; height: 330px; }
|
||||
.qrcode { position: absolute; top: 0; left: 0; width: 174px; height: 11pc; }
|
||||
.divimg { position: absolute; top: 50%; left: 50%; z-index: 100; overflow: hidden; margin-top: -15px; margin-left: -30px; padding: 1px; width: 60px; height: 30px; border: 1px solid #eee; border-radius: .5rem; background: #fff; opacity: .9; filter: alpha(opacity=90); -moz-opacity: .9; }
|
||||
.content .con_right ul .con_r_right .user .yanzheng { width: 150px; margin: 0 5px 10px 1px; padding-left: 5px; }
|
||||
.content .con_right ul .con_r_right .user .next { font-size: 12px; width: 40px; height: 33px; float: right; margin-right: 40px; }
|
||||
.content .con_right .con_r_top { *height: 90px; }
|
||||
|
||||
.autoWidth{margin:0 auto;min-width:1000px;max-width:1200px}
|
||||
.auto{margin:0 auto;min-width:1000px;max-width:1200px}
|
||||
@media screen and (max-width:1233px){.auto{padding-left:10px}
|
||||
}
|
||||
.clearfix:after,.clearfix:before{display:table;line-height:0;content:""}
|
||||
.clearfix:after{clear:both}
|
||||
.clear-float{clear:both}
|
||||
|
||||
.footer{background-color:#009fd9;font-family: 'microsoft yahei', sans-serif; }
|
||||
.footer-floor1{width:100%;padding:36px 0 60px}
|
||||
.footer-list{width:69%;height:100%;float:left}
|
||||
.footer-list ul{float:left;margin-right:13%}
|
||||
.footer-list .flist-4{margin-right:0}
|
||||
.footer-list li{line-height:32px}
|
||||
.footer-list li a{color:#b6e2f2;font-size:12px;text-decoration:none}
|
||||
.footer-list li a:hover{text-decoration:underline;color:#fff}
|
||||
.footer-list .flist-title{font-size:16px;color:#fff;margin-bottom:15px}
|
||||
.footer-floor2{width:100%;border-top:1px solid #4cc3ed;padding:20px 0;text-align:center}
|
||||
.footer-floor2 p{text-align:center;color:#b6e2f2;font-size:12px;line-height:30px}
|
||||
.footer-floor2 p span{font-family:PingFangSC-Light,'helvetica neue','hiragino sans gb',tahoma,'microsoft yahei ui','microsoft yahei',sans-serif}
|
||||
.footer-floor2 a{color:#b6e2f2}
|
||||
.footer-floor2 a:hover{color:#a8d0e0;text-decoration:underline}
|
||||
.foot-link{margin:0 15px;text-decoration:none;color:#b6e2f2}
|
||||
.foot-link:hover{text-decoration:underline}
|
||||
.footer-right{width:300px;float:right}
|
||||
.telephone{width:100%;height:32px;line-height:32px;color:#fff}
|
||||
.telephone .tel-number{font-size:30px;font-weight:400;text-align:right}
|
||||
.official-plat{width:100%;height:100%;margin-top:20px;position:relative}
|
||||
.official-plat ul{float:right;margin-top:7px}
|
||||
.official-plat ul li{height:45px}
|
||||
.official-plat ul a{display:inline-block;height:32px;width:100%;line-height:32px;color:#fff;text-decoration:none;font-size:12px}
|
||||
.official-plat>p{display:inline-block;width:132px;height:132px;border:1px solid #ddd;background-color:#fff}
|
||||
#wx-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:12px;right:-20px;z-index:10}
|
||||
#wb-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:58px;right:-20px;z-index:10}
|
||||
.five-superiority{width:100%;border-bottom:1px solid #27aede;padding:10px 0 20px}
|
||||
.five-superiority-list li{float:left;width:20%;height:36px;text-align:center;border-left:1px solid #27aede}
|
||||
.five-superiority-list li:first-child{border-left:none}
|
||||
.five-superiority-list li a{display:inline-block;position:relative;width:100%;height:36px;line-height:36px;background:no-repeat 2% center;text-indent:2em;color:#fff;font-size:16px}
|
||||
.five-superiority-list li a:hover{color:#bfe7f5}
|
||||
.five-superiority-list li a.superiority-text{text-indent:4em}
|
||||
.compensate_ico .superiority-icon{background-position:0 0}
|
||||
.compensate_ico:hover .superiority-icon{background-position:0 -50px}
|
||||
.retreat_ico .superiority-icon{background-position:0 -100px}
|
||||
.retreat_ico:hover .superiority-icon{background-position:0 -150px}
|
||||
.technology_ico .superiority-icon{background-position:0 -200px}
|
||||
.technology_ico:hover .superiority-icon{background-position:0 -250px}
|
||||
.prepare_ico .superiority-icon{background-position:0 -300px}
|
||||
.prepare_ico:hover .superiority-icon{background-position:0 -350px}
|
||||
.service_ico .superiority-icon{background-position:0 -400px}
|
||||
.service_ico:hover .superiority-icon{background-position:0 -450px}
|
||||
.marquee-box{overflow:hidden;width:100%;position:absolute;left:0;top:0}
|
||||
.marquee{width:8000%;height:60px}
|
||||
.wave-list-box{float:left}
|
||||
.wave-list-box ul{float:left;height:60px;overflow:hidden;zoom:1}
|
||||
.wave-list-box ul li{height:60px;width:100%;float:left;line-height:30px;list-style:none}
|
||||
.wave-box{position:relative;height:60px;background:#fff}
|
||||
|
|
@ -1,66 +1,54 @@
|
|||
*{margin:0;padding:0;box-sizing:border-box;list-style:none}
|
||||
html{height: 100%; width:100%}
|
||||
body{font-family:"Microsoft Yahei";min-width:1000px}
|
||||
a{outline:0;text-decoration:none}
|
||||
strong{font-weight:400}
|
||||
.strong{font-weight:700}
|
||||
::selection{background:#1EACDF;color:#fff}
|
||||
img{border:0}
|
||||
::-moz-selection{background:#1EACDF;color:#fff}
|
||||
::-webkit-selection{background:#1EACDF;color:#fff}
|
||||
.autoWidth{margin:0 auto;min-width:1000px;max-width:1200px}
|
||||
.auto{margin:0 auto;min-width:1000px;max-width:1200px}
|
||||
@media screen and (max-width:1233px){.auto{padding-left:10px}
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Microsoft Yahei", serif;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.a-middle-text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.grid {
|
||||
padding: 1px;
|
||||
line-height: 50px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.middle-header {
|
||||
margin-top: 30px;
|
||||
line-height: 50px;
|
||||
margin-bottom: 5%;
|
||||
border-color: #b7b7b7;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
.middle-header-title {
|
||||
margin-top: 30px;
|
||||
line-height: 50px;
|
||||
border-color: #b7b7b7;
|
||||
font-weight: bold;
|
||||
}
|
||||
.clearfix:after,.clearfix:before{display:table;line-height:0;content:""}
|
||||
.clearfix:after{clear:both}
|
||||
.clear-float{clear:both}
|
||||
|
||||
|
||||
.layui-panel {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.footer{background-color:#009fd9;font-family:"Microsoft Yahei"}
|
||||
.footer-floor1{width:100%;padding:36px 0 60px}
|
||||
.footer-list{width:69%;height:100%;float:left}
|
||||
.footer-list ul{float:left;margin-right:13%}
|
||||
.footer-list .flist-4{margin-right:0}
|
||||
.footer-list li{line-height:32px}
|
||||
.footer-list li a{color:#b6e2f2;font-size:12px;text-decoration:none}
|
||||
.footer-list li a:hover{text-decoration:underline;color:#fff}
|
||||
.footer-list .flist-title{font-size:16px;color:#fff;margin-bottom:15px}
|
||||
.footer-floor2{width:100%;border-top:1px solid #4cc3ed;padding:20px 0;text-align:center}
|
||||
.footer-floor2 p{text-align:center;color:#b6e2f2;font-size:12px;line-height:30px}
|
||||
.footer-floor2 p span{font-family:PingFangSC-Light,'helvetica neue','hiragino sans gb',tahoma,'microsoft yahei ui','microsoft yahei',simsun,sans-serif}
|
||||
.footer-floor2 a{color:#b6e2f2}
|
||||
.footer-floor2 a:hover{color:#a8d0e0;text-decoration:underline}
|
||||
.foot-link{margin:0 15px;text-decoration:none;color:#b6e2f2}
|
||||
.foot-link:hover{text-decoration:underline}
|
||||
.footer-right{width:300px;float:right}
|
||||
.official-plat{width:100%;height:100%;margin-top:20px;position:relative}
|
||||
.official-plat ul{float:right;margin-top:7px}
|
||||
.official-plat ul li{height:45px}
|
||||
.official-plat ul a{display:inline-block;height:32px;width:100%;line-height:32px;color:#fff;text-decoration:none;font-size:12px}
|
||||
.official-plat>p{display:inline-block;width:132px;height:132px;border:1px solid #ddd;background-color:#fff}
|
||||
#wx-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:12px;right:-20px;z-index:10}
|
||||
#wb-corner{border:10px solid transparent;border-left:10px solid #fff;position:absolute;top:58px;right:-20px;z-index:10}
|
||||
.five-superiority{width:100%;border-bottom:1px solid #27aede;padding:10px 0 20px}
|
||||
.five-superiority-list li{float:left;width:20%;height:36px;text-align:center;border-left:1px solid #27aede}
|
||||
.five-superiority-list li:first-child{border-left:none}
|
||||
.five-superiority-list li a{display:inline-block;position:relative;width:100%;height:36px;line-height:36px;background:no-repeat 2% center;text-indent:2em;color:#fff;font-size:16px}
|
||||
.five-superiority-list li a:hover{color:#bfe7f5}
|
||||
.five-superiority-list li a.superiority-text{text-indent:4em}
|
||||
.compensate_ico .superiority-icon{background-position:0 0}
|
||||
.compensate_ico:hover .superiority-icon{background-position:0 -50px}
|
||||
.retreat_ico .superiority-icon{background-position:0 -100px}
|
||||
.retreat_ico:hover .superiority-icon{background-position:0 -150px}
|
||||
.technology_ico .superiority-icon{background-position:0 -200px}
|
||||
.technology_ico:hover .superiority-icon{background-position:0 -250px}
|
||||
.prepare_ico .superiority-icon{background-position:0 -300px}
|
||||
.prepare_ico:hover .superiority-icon{background-position:0 -350px}
|
||||
.service_ico .superiority-icon{background-position:0 -400px}
|
||||
.service_ico:hover .superiority-icon{background-position:0 -450px}
|
||||
.marquee-box{overflow:hidden;width:100%;position:absolute;left:0;top:0}
|
||||
.marquee{width:8000%;height:60px}
|
||||
.wave-list-box{float:left}
|
||||
.wave-list-box ul{float:left;height:60px;overflow:hidden;zoom:1}
|
||||
.wave-list-box ul li{height:60px;width:100%;float:left;line-height:30px;list-style:none}
|
||||
.wave-box{position:relative;height:60px;background:#fff}
|
||||
.layui-elem-fieldset {
|
||||
margin-top: 10%;
|
||||
border-color: #b7b7b7;
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
function BtnClick(btn, type, unsecpwd) {
|
||||
$(btn).click(function () {
|
||||
// ^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$\%\^\&\*\(\)])[0-9a-zA-Z!@#$\%\^\&\*\(\)]{8,32}$ 要求密码了里面包含字母、数字、特殊字符。
|
||||
// (?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30} 密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位
|
||||
// (?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[!#@*&.])[a-zA-Z\d!#@*&.]*{8,30}$
|
||||
// 判断密码满足大写字母,小写字母,数字和特殊字符,其中四种组合都需要包含
|
||||
// (?=.*[0-9])(?=.*[a-zA-Z]).{8,30} 大小写字母+数字
|
||||
let regex_mail = new RegExp('^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$')
|
||||
let regex_pwd = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}');
|
||||
let new_password = $('#new_password').val()
|
||||
let old_password = $('#old_password').val()
|
||||
let ensure_password = $('#ensure_password').val()
|
||||
if ($.trim(old_password) === '' && type === 'modify') {
|
||||
$.alert('请输入旧密码');
|
||||
return false;
|
||||
} else if ($.trim(new_password) === '') {
|
||||
$.alert('请输入新密码');
|
||||
return false;
|
||||
} else if (jQuery.inArray(new_password, unsecpwd) !== -1) {
|
||||
$.alert('弱密码禁止使用,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
|
||||
return false;
|
||||
} else if (!regex_pwd.test($.trim(new_password))) {
|
||||
$.alert('密码不符合复杂度规则,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
|
||||
return false;
|
||||
} else if ($.trim(ensure_password) === '') {
|
||||
$.alert('请再次输入新密码');
|
||||
return false;
|
||||
} else if ($.trim(new_password) === $.trim(old_password)) {
|
||||
$.alert('新旧密码不能一样');
|
||||
return false;
|
||||
} else if ($.trim(ensure_password) !== $.trim(new_password)) {
|
||||
$.alert('两次输入的新密码不一致');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
var scanCodeButton = document.getElementById('scanCode')
|
||||
var modifyPwdButton = document.getElementById('modifyPwd')
|
||||
var container = document.getElementById('middle-container')
|
||||
|
||||
if (scanCodeButton !== null) {
|
||||
scanCodeButton.addEventListener('click', function () {
|
||||
container.classList.add('right-panel-active')
|
||||
})
|
||||
}
|
||||
if (modifyPwdButton !== null) {
|
||||
modifyPwdButton.addEventListener('click', function () {
|
||||
container.classList.remove('right-panel-active')
|
||||
});
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
(function(e,t){function n(e,t){var n=e.createElement("p"),i=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",i.insertBefore(n.lastChild,i.firstChild)}function i(){var e=m.elements;return"string"==typeof e?e.split(" "):e}function r(e){var t={},n=e.createElement,r=e.createDocumentFragment,o=r();e.createElement=function(e){m.shivMethods||n(e);var i;return i=t[e]?t[e].cloneNode():g.test(e)?(t[e]=n(e)).cloneNode():n(e),i.canHaveChildren&&!f.test(e)?o.appendChild(i):i},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(e){return t[e]=n(e),o.createElement(e),'c("'+e+'")'})+");return n}")(m,o)}function o(e){var t;return e.documentShived?e:(m.shivCSS&&!d&&(t=!!n(e,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),h||(t=!r(e)),t&&(e.documentShived=t),e)}function a(e){for(var t,n=e.getElementsByTagName("*"),r=n.length,o=RegExp("^(?:"+i().join("|")+")$","i"),a=[];r--;)t=n[r],o.test(t.nodeName)&&a.push(t.applyElement(s(t)));return a}function s(e){for(var t,n=e.attributes,i=n.length,r=e.ownerDocument.createElement(b+":"+e.nodeName);i--;)t=n[i],t.specified&&r.setAttribute(t.nodeName,t.nodeValue);return r.style.cssText=e.style.cssText,r}function l(e){for(var t,n=e.split("{"),r=n.length,o=RegExp("(^|[\\s,>+~])("+i().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),a="$1"+b+"\\:$2";r--;)t=n[r]=n[r].split("}"),t[t.length-1]=t[t.length-1].replace(o,a),n[r]=t.join("}");return n.join("{")}function c(e){for(var t=e.length;t--;)e[t].removeNode()}function u(e){var t,i,r=e.namespaces,o=e.parentWindow;return!y||e.printShived?e:(r[b]===void 0&&r.add(b),o.attachEvent("onbeforeprint",function(){for(var r,o,s,c=e.styleSheets,u=[],d=c.length,h=Array(d);d--;)h[d]=c[d];for(;s=h.pop();)if(!s.disabled&&v.test(s.media)){for(r=s.imports,d=0,o=r.length;o>d;d++)h.push(r[d]);try{u.push(s.cssText)}catch(p){}}u=l(u.reverse().join("")),i=a(e),t=n(e,u)}),o.attachEvent("onafterprint",function(){c(i),t.removeNode(!0)}),e.printShived=!0,e)}var d,h,p=e.html5||{},f=/^<|^(?:button|form|map|select|textarea|object|iframe)$/i,g=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i;(function(){var n=t.createElement("a");n.innerHTML="<xyz></xyz>",d="hidden"in n,d&&"function"==typeof injectElementWithStyles&&injectElementWithStyles("#modernizr{}",function(t){t.hidden=!0,d="none"==(e.getComputedStyle?getComputedStyle(t,null):t.currentStyle).display}),h=1==n.childNodes.length||function(){try{t.createElement("a")}catch(e){return!0}var n=t.createDocumentFragment();return n.cloneNode===void 0||n.createDocumentFragment===void 0||n.createElement===void 0}()})();var m={elements:p.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:p.shivCSS!==!1,shivMethods:p.shivMethods!==!1,type:"default",shivDocument:o};e.html5=m,o(t);var v=/^$|\b(?:all|print)\b/,b="html5shiv",y=!h&&function(){var n=t.documentElement;return t.namespaces!==void 0&&t.parentWindow!==void 0&&n.applyElement!==void 0&&n.removeNode!==void 0&&e.attachEvent!==void 0}();m.type+=" print",m.shivPrint=u,u(t)})(this,document);
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,5 @@
|
|||
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
||||
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
||||
* */
|
||||
|
||||
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-view{display:block;position:relative;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#fafafa;color:#333;font-family:Courier New;font-size:13px}.layui-code-title{position:relative;padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee;font-size:12px}.layui-code-title>.layui-code-about{position:absolute;right:10px;top:0;color:#b7b7b7}.layui-code-about>a{padding-left:10px}.layui-code-view>.layui-code-ol,.layui-code-view>.layui-code-ul{position:relative;overflow:auto}.layui-code-view>.layui-code-ol>li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view>.layui-code-ol>li:first-child,.layui-code-view>.layui-code-ul>li:first-child{padding-top:10px}.layui-code-view>.layui-code-ol>li:last-child,.layui-code-view>.layui-code-ul>li:last-child{padding-bottom:10px}.layui-code-view>.layui-code-ul>li{position:relative;line-height:20px;padding:0 10px;list-style-type:none;*list-style-type:none;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-dark{border:1px solid #0c0c0c;border-left-color:#3f3f3f;background-color:#0c0c0c;color:#c2be9e}.layui-code-dark>.layui-code-title{border-bottom:none}.layui-code-dark>.layui-code-ol>li,.layui-code-dark>.layui-code-ul>li{background-color:#3f3f3f;border-left:none}.layui-code-dark>.layui-code-ul>li{margin-left:6px}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 701 B |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 299 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,57 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta http-equiv="Pragma" content= "no-cache" />
|
||||
<meta http-equiv="Cache-Control" content= "no-cache" />
|
||||
<meta http-equiv="Expires" content= "0" />
|
||||
<title>{{ global_title }}</title>
|
||||
<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/style.css' %}">
|
||||
{% block headercss %}{% endblock %}
|
||||
{% block headerjs %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{% static 'js/html5.min.js' %}"></script>
|
||||
<script src="{% static 'js/respond.min.js' %}"></script>
|
||||
<![endif]-->
|
||||
<div class="layui-container">
|
||||
<div class="layui-row">
|
||||
<div class="layui-hide-xs layui-col-md1">
|
||||
<div class="grid"></div>
|
||||
</div>
|
||||
<div class="layui-col-xs12 layui-col-md10">
|
||||
<div class="grid">
|
||||
<div class="middle-header">
|
||||
<h1>{{ global_title }}</h1>
|
||||
</div>
|
||||
<div class="layui-panel">
|
||||
<div class="layui-row">
|
||||
{% block upmiddleheader %}{% endblock %}
|
||||
</div>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
||||
<legend>
|
||||
{% block paneltitle %}{% endblock %}
|
||||
</legend>
|
||||
</fieldset>
|
||||
{% block middleblock %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
{% block middleblockfoot %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-hide-xs layui-col-md1">
|
||||
<div class="grid"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{% static 'layui/layui.js' %}" charset="utf-8"></script>
|
||||
{% block footercss %}{% endblock %}
|
||||
{% block footerjs %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -1,90 +0,0 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>自助密码平台</title>
|
||||
<link rel="stylesheet" href="{% static 'css/dmaku.css' %}">
|
||||
<script type="text/javascript" src="{% static 'js/jquery-1.8.3.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/check.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/dingtalk.open.js' %}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="head-container" id="head-container">
|
||||
<p>
|
||||
密码自助服务平台
|
||||
</p>
|
||||
</div>
|
||||
<div class="middle-container" id="middle-container">
|
||||
<div class="form-container right-content-container">
|
||||
<form action="">
|
||||
</form>
|
||||
</div>
|
||||
<div class="form-container left-content-container">
|
||||
<form action="/" method="post" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<h1>修改密码</h1>
|
||||
<span>新密码8至30位长度,要求包含大小写字母及数字。</span>
|
||||
<input type="text" id="username" name="username" placeholder="账号,格式:abc\lisi、lisi、lisi@abc.com">
|
||||
<input type="password" id="old_password" name="old_password" placeholder="旧密码">
|
||||
<input type="password" id="new_password" name="new_password" placeholder="新密码">
|
||||
<input type="password" id="ensure_password" name="ensure_password" placeholder="再次确认新密码">
|
||||
<p></p>
|
||||
<button id="btn_modify" type="submit">提交</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="overlay-container">
|
||||
<div class="overlay">
|
||||
<div class="overlay-panel overlay-left">
|
||||
<h1>我要修改密码</h1>
|
||||
<p>记得自己的旧密码,需要自行修改</p>
|
||||
<p>⬇️⇓点它</p>
|
||||
<button class="ghost" id="modifyPwd">我要修改密码</button>
|
||||
</div>
|
||||
<div class="overlay-panel overlay-right">
|
||||
<h1>忘记密码或被锁</h1>
|
||||
<p>如果密码己遗忘,可通过使用⌊{{ scan_app }}⌉免密登录授权通过身份验证后方可重置</p>
|
||||
<p></p>
|
||||
<p>⬇️点它</p>
|
||||
<form action="/resetPassword" id="formDingLogin" name="formDingLogin" method="get">
|
||||
<input type="hidden" name="code" value="" id="code">
|
||||
<button class="ghost" id="dingLogin" type="submit">我要重置密码</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{% static 'js/dmaku.js' %}"></script>
|
||||
<script>
|
||||
BtnClick("#btn_modify", 'modify', {{ unsecpwd|safe }})
|
||||
let code;
|
||||
window.onload = function () {
|
||||
if (dd.env.platform !== 'notInDingTalk') {
|
||||
dd.ready(() => {
|
||||
dd.runtime.permission.requestAuthCode({corpId: '{{ corp_id }}'}).then((result) => {
|
||||
code = result.code;
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
}).finally(() => {
|
||||
document.getElementById("code").setAttribute("value", code)
|
||||
})
|
||||
});
|
||||
} else {
|
||||
$.alert('请在钉钉中访问本应用!')
|
||||
}
|
||||
}
|
||||
/** 回退事件 **/
|
||||
dd.ready(function () {
|
||||
document.addEventListener('backbutton', function (e) {
|
||||
e.preventDefault();
|
||||
dd.biz.navigation.close({
|
||||
onSuccess: function (result) {
|
||||
},
|
||||
onFail: function (err) {
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,107 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block headerjs %}<script type="text/javascript" src="{% static 'js/dingtalk.open.js' %}"></script>{% endblock %}
|
||||
{% block paneltitle %}修改密码{% endblock %}
|
||||
{% block middleblock %}
|
||||
<div class="layui-row">
|
||||
<form class="layui-form layui-form-pane" action="/" method="post" autocomplete="off">{% csrf_token %}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" lay-verify="required" lay-verType="tips" autocomplete="off" placeholder="请输入账号" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">旧密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" lay-verify="required|newpass" lay-verType="tips" name="old_password" id="old_password" placeholder="请输入旧密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" lay-verify="pass" lay-verType="tips" name="new_password" id="new_password" placeholder="请输入新密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" lay-verify="pass|repass" lay-verType="tips" name="ensure_password" id="ensure_password" placeholder="再次确认新密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" lay-submit="" class="layui-btn layui-btn-normal layui-btn-fluid">立即提交</button>
|
||||
</div>
|
||||
<div class="layui-form-item a-middle-text">
|
||||
<span class="layui-breadcrumb">
|
||||
<a class="layui-text" id="redirect_url" href=""><i class="layui-icon layui-icon-refresh-3"></i> 重置/解锁账号</a>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block middleblockfoot %}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
新密码8至30位长度,要求包含大小写字母及数字。<br><br>
|
||||
如果密码己遗忘,可点击上方<b>[<i class="layui-icon layui-icon-refresh-3"></i> 重置/解锁账号]</b>使用⌊{{ scan_app }}⌉应用内免登录授权并通过身份验证后进行重置/解锁账号。<br>
|
||||
* 如果有当弹出提示<b>是否同意授权</b>时,请务必<b>全部同意</b>,否则无法获取关键信息,导致无法正常使用重置/解锁账号!
|
||||
</blockquote>
|
||||
{% endblock %}
|
||||
{% block footercss %}{% endblock %}
|
||||
{% block footerjs %}
|
||||
<script src="{% static 'layui/layui.js' %}"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'layer'], function () {
|
||||
let form = layui.form,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
if ('{{ app_type }}' === 'DING') {
|
||||
let re_url= ""
|
||||
window.onload = function () {
|
||||
if (dd.env.platform !== 'notInDingTalk') {
|
||||
dd.ready(() => {
|
||||
dd.runtime.permission.requestAuthCode({corpId: '{{ corp_id }}'}).then((result) => {
|
||||
re_url = '/resetPassword?code=' + result.code
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
}).finally(() => {
|
||||
document.getElementById("redirect_url").setAttribute("href", re_url)
|
||||
})
|
||||
});
|
||||
} else {
|
||||
layer.open({
|
||||
title : '出错啦!'
|
||||
,content: '请在钉钉中打开本页面~~'
|
||||
,btn: '关闭'
|
||||
,btnAlign: 'c'
|
||||
,yes: function(){
|
||||
layer.closeAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if ('{{ app_type }}' === 'WEWORK') {
|
||||
let re_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={{ app_id }}&agentid={{ agent_id }}&redirect_uri={{ redirect_url }}&response_type=code&scope=snsapi_privateinfo&state=#wechat_redirect"
|
||||
window.onload = function () {
|
||||
document.getElementById("redirect_url").setAttribute("href", re_url)
|
||||
}
|
||||
}
|
||||
form.verify({
|
||||
pass: [
|
||||
/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}$/,
|
||||
'密码必须8到30位,要求包含大小写字母、数字与字符,且不能出现空格!'
|
||||
],
|
||||
repass: function (value,item) {
|
||||
if ($('#ensure_password').val() !== $('#new_password').val()) {
|
||||
return '两次输入密码不一致!';
|
||||
}
|
||||
},
|
||||
newpass: function (value,item) {
|
||||
if ($('#old_password').val() === $('#password').val()) {
|
||||
return '新旧密码不能重复使用,请修正!';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -0,0 +1,15 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block paneltitle %}结果{% endblock %}
|
||||
{% block middleblock %}
|
||||
<div class="layui-row">
|
||||
<form class="layui-form layui-form-pane" method="get" autocomplete="off">{% csrf_token %}
|
||||
<div class="layui-form-item">
|
||||
{{ msg }}
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-fluid" onclick="{{ button_click }}">{{ button_display }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,39 +0,0 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>自助密码平台</title>
|
||||
<link rel="stylesheet" href="{% static 'css/dmaku.css' %}">
|
||||
<script type="text/javascript" src="{% static 'js/jquery-1.8.3.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/check.js' %}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="head-container" id="head-container">
|
||||
<p>
|
||||
密码自助服务平台
|
||||
</p>
|
||||
</div>
|
||||
<div class="middle-container" id="middle-container">
|
||||
<div class="form-container right-content-container"></div>
|
||||
<div class="form-container left-content-container">
|
||||
<form action="messages" method="get" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<h1>结果</h1>
|
||||
<p style="font-size: 16px">{{ msg }}</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="overlay-container">
|
||||
<div class="overlay">
|
||||
<div class="overlay-panel overlay-left"></div>
|
||||
<div class="overlay-panel overlay-right">
|
||||
<button class="ghost" id="btn_back" type="button" onclick="{{ button_click }}">{{ button_display }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{% static 'js/dmaku.js' %}"></script>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,68 +0,0 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>自助密码平台</title>
|
||||
<link rel="stylesheet" href="{% static 'css/dmaku.css' %}">
|
||||
<script type="text/javascript" src="{% static 'js/jquery-1.8.3.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/check.js' %}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="head-container" id="head-container">
|
||||
<p>
|
||||
密码自助服务平台
|
||||
</p>
|
||||
</div>
|
||||
<div class="middle-container" id="middle-container">
|
||||
<div class="form-container right-content-container">
|
||||
<form name="unlockAccount" method="post" action="unlockAccount" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<h1>重置</h1>
|
||||
<input type="text" id="username" name="username" readonly placeholder="{{ username }}" value="{{ username }}">
|
||||
<input type="hidden" id="code" name="code" readonly value="{{ code }}">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<button id="btn_unlock" type="submit">解锁账号</button>
|
||||
<p>会话有效期5分钟</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="form-container left-content-container">
|
||||
<form name="resetPassword" method="post" action="" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<h1>重置</h1>
|
||||
<span>新密码8至30位长度,要求包含大小写字母及数字。</span>
|
||||
<input type="text" id="username" name="username" readonly placeholder="{{ username }}" value="{{ username }}">
|
||||
<input type="hidden" id="code" name="code" readonly value="{{ code }}">
|
||||
<input type="password" id="new_password" name="new_password" placeholder="新密码">
|
||||
<input type="password" id="ensure_password" name="ensure_password" placeholder="再次确认新密码">
|
||||
<p></p>
|
||||
<button id="btn_reset" type="submit">重置密码</button>
|
||||
<p>会话有效期5分钟,重密码会自动解锁账号</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="overlay-container">
|
||||
<div class="overlay">
|
||||
<div class="overlay-panel overlay-left">
|
||||
<h1>我要重置密码</h1>
|
||||
<p></p>
|
||||
<p>⬇️点它</p>
|
||||
<button class="ghost" id="modifyPwd">点我重置密码</button>
|
||||
<a class="ghost" href="/">返回主页</a>
|
||||
</div>
|
||||
<div class="overlay-panel overlay-right">
|
||||
<h1>我要解锁账号</h1>
|
||||
<p></p>
|
||||
<p>⬇️点它</p>
|
||||
<button class="ghost" id="scanCode">点我解锁账号</button>
|
||||
<a class="ghost" href="/">返回主页</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{% static 'js/dmaku.js' %}"></script>
|
||||
<script>
|
||||
BtnClick("#btn_reset", 'reset', {{ unsecpwd|safe }})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,63 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block paneltitle %}重置密码{% endblock %}
|
||||
{% block middleblock %}
|
||||
<div class="layui-row">
|
||||
<form class="layui-form layui-form-pane" name="resetPassword" method="post" action="" autocomplete="off">{% csrf_token %}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" lay-verify="required" lay-verType="tips" autocomplete="off" readonly value="{{ username }}" class="layui-input">
|
||||
<input type="hidden" id="code" name="code" readonly value="{{ code }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" lay-verify="pass" lay-verType="tips" name="new_password" id="new_password" placeholder="请输入新密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" lay-verify="pass|repass" lay-verType="tips" name="ensure_password" id="ensure_password" placeholder="再次确认新密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" lay-submit="" class="layui-btn layui-btn-normal layui-btn-fluid">立即提交</button>
|
||||
</div>
|
||||
<div class="layui-form-item a-middle-text">
|
||||
<span class="layui-breadcrumb">
|
||||
<a class="layui-text" href="/"><i class="layui-icon layui-icon-prev"></i> 返回主页</a>
|
||||
<a class="layui-text" id="redirect_url" href="/unlockAccount?code={{ code }}&username={{ username }}"><i class="layui-icon layui-icon-password"></i> 解锁账号</a>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block middleblockfoot %}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
新密码8至30位长度,要求包含大小写字母及数字。
|
||||
<p>会话有效期5分钟,重置密码会自动解锁账号(己禁用的账号不会生效)</p>
|
||||
</blockquote>
|
||||
{% endblock %}
|
||||
{% block footerjs %}
|
||||
<script src="{% static 'layui/layui.js' %}"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery',], function () {
|
||||
let form = layui.form,
|
||||
$ = layui.jquery;
|
||||
form.verify({
|
||||
pass: [
|
||||
/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}$/,
|
||||
'密码必须8到30位,要求包含大小写字母、数字与字符,且不能出现空格!'
|
||||
],
|
||||
repass: function (value,item) {
|
||||
if ($('#ensure_password').val() !== $('#new_password').val()) {
|
||||
return '两次输入密码不一致!';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -0,0 +1,31 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block paneltitle %}解锁账号{% endblock %}
|
||||
{% block middleblock %}
|
||||
<div class="layui-row">
|
||||
<form class="layui-form layui-form-pane" name="unlockAccount" method="post" action="unlockAccount" autocomplete="off">{% csrf_token %}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" lay-verify="required" lay-verType="tips" autocomplete="off" readonly value="{{ username }}" class="layui-input">
|
||||
<input type="hidden" id="code" name="code" readonly value="{{ code }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" lay-submit="" class="layui-btn layui-btn-normal layui-btn-fluid">立即提交</button>
|
||||
</div>
|
||||
<div class="layui-form-item a-middle-text">
|
||||
<span class="layui-breadcrumb">
|
||||
<a class="layui-text" href="/"><i class="layui-icon layui-icon-prev"></i> 返回主页</a>
|
||||
<a class="layui-text" id="redirect_url" href="/resetPassword?code={{ code }}&username={{ username }}"><i class="layui-icon layui-icon-refresh-1"></i> 重置密码</a>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block middleblockfoot %}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
新密码8至30位长度,要求包含大小写字母及数字。
|
||||
<p>会话有效期5分钟</p>
|
||||
</blockquote>
|
||||
{% endblock %}
|
|
@ -1,59 +0,0 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>自助密码平台</title>
|
||||
<link rel="stylesheet" href="{% static 'css/dmaku.css' %}">
|
||||
<script type="text/javascript" src="{% static 'js/jquery-1.8.3.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/check.js' %}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="head-container" id="head-container">
|
||||
<p>
|
||||
密码自助服务平台
|
||||
</p>
|
||||
</div>
|
||||
<div class="middle-container" id="middle-container">
|
||||
<div class="form-container right-content-container">
|
||||
<form action="">
|
||||
</form>
|
||||
</div>
|
||||
<div class="form-container left-content-container">
|
||||
<form action="/" method="post" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<h1>修改密码</h1>
|
||||
<span>新密码8至30位长度,要求包含大小写字母及数字。</span>
|
||||
<input type="text" id="username" name="username" placeholder="账号,格式:abc\lisi、lisi、lisi@abc.com">
|
||||
<input type="password" id="old_password" name="old_password" placeholder="旧密码">
|
||||
<input type="password" id="new_password" name="new_password" placeholder="新密码">
|
||||
<input type="password" id="ensure_password" name="ensure_password" placeholder="再次确认新密码">
|
||||
<p></p>
|
||||
<button id="btn_modify" type="submit">提交</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="overlay-container">
|
||||
<div class="overlay">
|
||||
<div class="overlay-panel overlay-left">
|
||||
<h1>我要修改密码</h1>
|
||||
<p>记得自己的旧密码,需要自行修改</p>
|
||||
<p>⬇️⇓点它</p>
|
||||
<button class="ghost" id="modifyPwd">我要修改密码</button>
|
||||
</div>
|
||||
<div class="overlay-panel overlay-right">
|
||||
<h1>忘记密码或被锁</h1>
|
||||
<p>如果密码己遗忘,可通过使用⌊{{ scan_app }}⌉OAuth2授权通过身份验证后方可重置</p>
|
||||
<p>当弹出<b>是否同意授权</b>时,请务必<b>全部同意</b>,否则无法获取关键信息,导致无法正常重置/解锁账号!</p>
|
||||
<p>⬇️点它</p>
|
||||
<a class="ghost" href="https://open.weixin.qq.com/connect/oauth2/authorize?appid={{ app_id }}&agentid={{ agent_id }}&redirect_uri={{ redirect_url }}&response_type=code&scope=snsapi_privateinfo&state=#wechat_redirect">我要重置密码</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{% static 'js/dmaku.js' %}"></script>
|
||||
<script>
|
||||
let oauth2_inner = document.getElementsByClassName("form-container right-content-container")
|
||||
BtnClick("#btn_modify", 'modify',{{ unsecpwd|safe }})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
115
utils/ad_ops.py
115
utils/ad_ops.py
|
@ -1,9 +1,11 @@
|
|||
import ldap3
|
||||
from ldap3 import *
|
||||
from ldap3.core.exceptions import LDAPInvalidCredentialsResult, LDAPOperationResult, LDAPExceptionError,LDAPException
|
||||
from ldap3.core.exceptions import LDAPInvalidCredentialsResult, LDAPOperationResult, LDAPExceptionError, LDAPException, \
|
||||
LDAPSocketOpenError
|
||||
from ldap3.core.results import *
|
||||
from ldap3.utils.dn import safe_dn
|
||||
import os
|
||||
|
||||
APP_ENV = os.getenv('APP_ENV')
|
||||
if APP_ENV == 'dev':
|
||||
from conf.local_settings_dev import *
|
||||
|
@ -36,7 +38,8 @@ unicodePwd 属性的语法为 octet-string;但是,目录服务预期八进制
|
|||
|
||||
class AdOps(object):
|
||||
|
||||
def __init__(self, auto_bind=True, use_ssl=AD_USE_SSL, port=AD_CONN_PORT, domain=AD_DOMAIN, user=AD_LOGIN_USER, password=AD_LOGIN_USER_PWD,
|
||||
def __init__(self, auto_bind=True, use_ssl=AD_USE_SSL, port=AD_CONN_PORT, domain=AD_DOMAIN, user=AD_LOGIN_USER,
|
||||
password=AD_LOGIN_USER_PWD,
|
||||
authentication=NTLM):
|
||||
"""
|
||||
AD连接器 authentication [SIMPLE, ANONYMOUS, SASL, NTLM]
|
||||
|
@ -51,17 +54,38 @@ class AdOps(object):
|
|||
self.password = password
|
||||
self.authentication = authentication
|
||||
self.auto_bind = auto_bind
|
||||
self.server = None
|
||||
self.conn = None
|
||||
|
||||
server = Server(host='%s' % AD_HOST, connect_timeout=1, use_ssl=self.use_ssl, port=port, get_info=ALL)
|
||||
try:
|
||||
self.conn = Connection(server, auto_bind=self.auto_bind, user=r'{}\{}'.format(self.domain, self.user), password=self.password,
|
||||
authentication=self.authentication, raise_exceptions=True)
|
||||
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))
|
||||
def __server(self):
|
||||
if self.server is None:
|
||||
try:
|
||||
self.server = Server(host='%s' % AD_HOST, connect_timeout=1, use_ssl=self.use_ssl, port=self.port,
|
||||
get_info=ALL)
|
||||
except LDAPInvalidCredentialsResult as lic_e:
|
||||
return False, LDAPOperationResult("LDAPInvalidCredentialsResult: " + str(lic_e.message))
|
||||
except LDAPOperationResult as lo_e:
|
||||
return False, LDAPOperationResult("LDAPOperationResult: " + str(lo_e.message))
|
||||
except LDAPException as l_e:
|
||||
return False, LDAPException("LDAPException: " + str(l_e))
|
||||
|
||||
def __conn(self):
|
||||
if self.conn is None:
|
||||
try:
|
||||
self.__server()
|
||||
self.conn = Connection(self.server,
|
||||
auto_bind=self.auto_bind, user=r'{}\{}'.format(self.domain, self.user),
|
||||
password=self.password,
|
||||
authentication=self.authentication,
|
||||
raise_exceptions=True)
|
||||
except LDAPInvalidCredentialsResult as lic_e:
|
||||
return False, LDAPOperationResult("LDAPInvalidCredentialsResult: " + str(lic_e.message))
|
||||
|
||||
except LDAPOperationResult as lo_e:
|
||||
return False, LDAPOperationResult("LDAPOperationResult: " + str(lo_e.message))
|
||||
|
||||
except LDAPException as l_e:
|
||||
return False, LDAPException("LDAPException: " + str(l_e))
|
||||
|
||||
def ad_auth_user(self, username, password):
|
||||
"""
|
||||
|
@ -71,8 +95,9 @@ class AdOps(object):
|
|||
:return: True or False
|
||||
"""
|
||||
try:
|
||||
server = Server(host='%s' % AD_HOST, use_ssl=self.use_ssl, port=self.port, get_info=ALL)
|
||||
c_auth = Connection(server=server, user=r'{}\{}'.format(self.domain, username), password=password, auto_bind=True, raise_exceptions=True)
|
||||
self.__server()
|
||||
c_auth = Connection(server=self.server, user=r'{}\{}'.format(self.domain, username), password=password,
|
||||
auto_bind=True, raise_exceptions=True)
|
||||
c_auth.unbind()
|
||||
return True, '旧密码验证通过。'
|
||||
except LDAPInvalidCredentialsResult as e:
|
||||
|
@ -92,11 +117,15 @@ class AdOps(object):
|
|||
# 如果仅仅使用普通凭据来绑定ldap用途,请返回False, 让用户通过其他途径修改密码后再来验证登陆
|
||||
# return False, '用户登陆前必须修改密码!'
|
||||
# 设置该账号下次登陆不需要更改密码,再验证一次
|
||||
self.conn.search(search_base=BASE_DN, search_filter='(sAMAccountName={}))'.format(username), attributes=['pwdLastSet'])
|
||||
self.__conn()
|
||||
self.conn.search(search_base=BASE_DN, search_filter='(sAMAccountName={}))'.format(username),
|
||||
attributes=['pwdLastSet'])
|
||||
self.conn.modify(self.conn.entries[0].entry_dn, {'pwdLastSet': [(MODIFY_REPLACE, ['-1'])]})
|
||||
return self.ad_auth_user(username, password)
|
||||
return True, self.ad_auth_user(username, password)
|
||||
else:
|
||||
return False, u'旧密码认证失败,请确认账号的旧密码是否正确或使用重置密码功能。'
|
||||
except LDAPException as e:
|
||||
return False, "连接Ldap失败,报错如下:{}".format(e)
|
||||
|
||||
def ad_ensure_user_by_account(self, username):
|
||||
"""
|
||||
|
@ -105,9 +134,11 @@ class AdOps(object):
|
|||
:return: True or False
|
||||
"""
|
||||
try:
|
||||
return True, self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username), attributes=['sAMAccountName'])
|
||||
self.__conn()
|
||||
return True, self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username),
|
||||
attributes=['sAMAccountName'])
|
||||
except Exception as e:
|
||||
return False, "AdOps Exception: {}" .format(e)
|
||||
return False, "AdOps Exception: {}".format(e)
|
||||
|
||||
def ad_get_user_displayname_by_account(self, username):
|
||||
"""
|
||||
|
@ -116,10 +147,11 @@ class AdOps(object):
|
|||
:return: user_displayname
|
||||
"""
|
||||
try:
|
||||
self.__conn()
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username), attributes=['name'])
|
||||
return True, self.conn.entries[0]['name']
|
||||
except Exception as e:
|
||||
return False, "AdOps Exception: {}" .format(e)
|
||||
return False, "AdOps Exception: {}".format(e)
|
||||
|
||||
def ad_get_user_dn_by_account(self, username):
|
||||
"""
|
||||
|
@ -128,10 +160,12 @@ class AdOps(object):
|
|||
:return: DN
|
||||
"""
|
||||
try:
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username), attributes=['distinguishedName'])
|
||||
self.__conn()
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username),
|
||||
attributes=['distinguishedName'])
|
||||
return True, str(self.conn.entries[0]['distinguishedName'])
|
||||
except Exception as e:
|
||||
return False, "AdOps Exception: {}" .format(e)
|
||||
return False, "AdOps Exception: {}".format(e)
|
||||
|
||||
def ad_get_user_status_by_account(self, username):
|
||||
"""
|
||||
|
@ -140,10 +174,12 @@ class AdOps(object):
|
|||
:return: user_account_control code
|
||||
"""
|
||||
try:
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username), attributes=['userAccountControl'])
|
||||
self.__conn()
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username),
|
||||
attributes=['userAccountControl'])
|
||||
return True, self.conn.entries[0]['userAccountControl']
|
||||
except Exception as e:
|
||||
return False, "AdOps Exception: {}" .format(e)
|
||||
return False, "AdOps Exception: {}".format(e)
|
||||
|
||||
def ad_unlock_user_by_account(self, username):
|
||||
"""
|
||||
|
@ -189,7 +225,8 @@ class AdOps(object):
|
|||
# change was not successful, raises exception if raise_exception = True in connection or returns the operation result, error code is in result['result']
|
||||
if self.conn.raise_exceptions:
|
||||
from ldap3.core.exceptions import LDAPOperationResult
|
||||
_msg = LDAPOperationResult(result=result['result'], description=result['description'], dn=result['dn'], message=result['message'],
|
||||
_msg = LDAPOperationResult(result=result['result'], description=result['description'], dn=result['dn'],
|
||||
message=result['message'],
|
||||
response_type=result['type'])
|
||||
return False, _msg
|
||||
return False, result['result']
|
||||
|
@ -203,35 +240,13 @@ class AdOps(object):
|
|||
:return: 如果结果是1601-01-01说明账号未锁定,返回0
|
||||
"""
|
||||
try:
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username), attributes=['lockoutTime'])
|
||||
self.__conn()
|
||||
self.conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName={}))'.format(username),
|
||||
attributes=['lockoutTime'])
|
||||
locked_status = self.conn.entries[0]['lockoutTime']
|
||||
if '1601-01-01' in str(locked_status):
|
||||
return True, 'unlocked'
|
||||
else:
|
||||
return False, locked_status
|
||||
except Exception as e:
|
||||
return False, "AdOps Exception: {}" .format(e)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# server = Server(host='%s' % AD_HOST, use_ssl=AD_USE_SSL, port=AD_CONN_PORT, get_info=ALL)
|
||||
# conn = Connection(server, auto_bind=True, user=str(AD_LOGIN_USER).lower(), password=AD_LOGIN_USER_PWD, authentication=SIMPLE)
|
||||
# # conn.bind()
|
||||
# # conn.search(BASE_DN, '(&(objectclass=user)(sAMAccountName=xiangle))', attributes=['name'])
|
||||
# # print(conn.entries[0])
|
||||
# print(conn.result)
|
||||
|
||||
# conn = _ad_connect()
|
||||
# user = 'zhangsan'
|
||||
# old_password = 'K2dhhuT1Zf11111cnJ1ollC3y'
|
||||
# # old_password = 'L1qyrmZDUFeYW1OIualjlNhr4'
|
||||
# new_password = 'K2dhhuT1Zf11111cnJ1ollC3y'
|
||||
# ad_ops = AdOps()
|
||||
# # ad_ops = AdOps(user=user, password=old_password)
|
||||
# status, msg = ad_ops.ad_auth_user(username=user, password=old_password)
|
||||
# print(msg)
|
||||
# if status:
|
||||
# res = ad_ops.ad_reset_user_pwd_by_account(user, new_password)
|
||||
# print(res)
|
||||
_ad = AdOps()
|
||||
print(_ad.ad_ensure_user_by_account('le.xiang'))
|
||||
return False, "AdOps Exception: {}".format(e)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
from cryptography.fernet import Fernet
|
||||
|
||||
|
||||
class Crypto(object):
|
||||
"""docstring for ClassName"""
|
||||
def __init__(self, key):
|
||||
self.factory = Fernet(key)
|
||||
|
||||
# 加密
|
||||
def encrypt(self, string):
|
||||
token = str(self.factory.encrypt(string.encode('utf-8')), 'utf-8')
|
||||
return token
|
||||
|
||||
# 解密
|
||||
def decrypt(self, token):
|
||||
string = self.factory.decrypt(bytes(token.encode('utf-8'))).decode('utf-8')
|
||||
return string
|
|
@ -4,8 +4,8 @@ from __future__ import absolute_import, unicode_literals
|
|||
from dingtalk.client import AppKeyClient
|
||||
from pwdselfservice import cache_storage
|
||||
|
||||
|
||||
import os
|
||||
|
||||
APP_ENV = os.getenv('APP_ENV')
|
||||
|
||||
if APP_ENV == 'dev':
|
||||
|
@ -15,7 +15,8 @@ else:
|
|||
|
||||
|
||||
class DingDingOps(AppKeyClient):
|
||||
def __init__(self, corp_id=DING_CORP_ID, app_key=DING_APP_KEY, app_secret=DING_APP_SECRET, mo_app_id=DING_MO_APP_ID, mo_app_secret=DING_MO_APP_SECRET,
|
||||
def __init__(self, corp_id=DING_CORP_ID, app_key=DING_APP_KEY, app_secret=DING_APP_SECRET, mo_app_id=DING_MO_APP_ID,
|
||||
mo_app_secret=DING_MO_APP_SECRET,
|
||||
storage=cache_storage):
|
||||
super().__init__(corp_id, app_key, app_secret, storage)
|
||||
self.corp_id = corp_id
|
||||
|
@ -58,18 +59,18 @@ class DingDingOps(AppKeyClient):
|
|||
_status, user_id = self.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 = self.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
|
||||
|
|
|
@ -51,8 +51,3 @@ def get_user_is_active(user_info):
|
|||
except (KeyError, IndexError) as k_error:
|
||||
return False, 'get_user_is_active: %s' % str(k_error)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
user = 'jf.com\XiangLe'
|
||||
username = format2username(user)
|
||||
print(username)
|
||||
|
|
|
@ -23,7 +23,7 @@ class MemoryStorage(BaseStorage):
|
|||
else:
|
||||
return default
|
||||
|
||||
def set(self, key, value, ttl=None):
|
||||
def set(self, key, value, ttl=3600):
|
||||
if value is None:
|
||||
return
|
||||
self._data[key] = (value, int(time.time()) + ttl)
|
||||
|
|
|
@ -22,8 +22,6 @@ else:
|
|||
CORP_API_TYPE = {
|
||||
'GET_USER_TICKET_OAUTH2': ['/cgi-bin/auth/getuserinfo?access_token=ACCESS_TOKEN', 'GET'],
|
||||
'GET_USER_INFO_OAUTH2': ['/cgi-bin/auth/getuserdetail?access_token=ACCESS_TOKEN', 'POST'],
|
||||
|
||||
|
||||
'GET_ACCESS_TOKEN': ['/cgi-bin/gettoken', 'GET'],
|
||||
'USER_CREATE': ['/cgi-bin/user/create?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'USER_GET': ['/cgi-bin/user/get?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
@ -35,12 +33,10 @@ CORP_API_TYPE = {
|
|||
'USERID_TO_OPENID': ['/cgi-bin/user/convert_to_openid?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'OPENID_TO_USERID': ['/cgi-bin/user/convert_to_userid?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'USER_AUTH_SUCCESS': ['/cgi-bin/user/authsucc?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'DEPARTMENT_CREATE': ['/cgi-bin/department/create?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'DEPARTMENT_UPDATE': ['/cgi-bin/department/update?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'DEPARTMENT_DELETE': ['/cgi-bin/department/delete?access_token=ACCESS_TOKEN', 'GET'],
|
||||
'DEPARTMENT_LIST': ['/cgi-bin/department/list?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'TAG_CREATE': ['/cgi-bin/tag/create?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'TAG_UPDATE': ['/cgi-bin/tag/update?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'TAG_DELETE': ['/cgi-bin/tag/delete?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
@ -48,34 +44,24 @@ CORP_API_TYPE = {
|
|||
'TAG_ADD_USER': ['/cgi-bin/tag/addtagusers?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'TAG_DELETE_USER': ['/cgi-bin/tag/deltagusers?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'TAG_GET_LIST': ['/cgi-bin/tag/list?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'BATCH_JOB_GET_RESULT': ['/cgi-bin/batch/getresult?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'BATCH_INVITE': ['/cgi-bin/batch/invite?access_token=ACCESS_TOKEN', 'POST'],
|
||||
|
||||
'AGENT_GET': ['/cgi-bin/agent/get?access_token=ACCESS_TOKEN', 'GET'],
|
||||
'AGENT_SET': ['/cgi-bin/agent/set?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'AGENT_GET_LIST': ['/cgi-bin/agent/list?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'MENU_CREATE': ['/cgi-bin/menu/create?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'MENU_GET': ['/cgi-bin/menu/get?access_token=ACCESS_TOKEN', 'GET'],
|
||||
'MENU_DELETE': ['/cgi-bin/menu/delete?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'MESSAGE_SEND': ['/cgi-bin/message/send?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'MESSAGE_REVOKE': ['/cgi-bin/message/revoke?access_token=ACCESS_TOKEN', 'POST'],
|
||||
|
||||
'MEDIA_GET': ['/cgi-bin/media/get?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'GET_USER_INFO_BY_CODE': ['/cgi-bin/user/getuserinfo?access_token=ACCESS_TOKEN', 'GET'],
|
||||
'GET_USER_DETAIL': ['/cgi-bin/user/getuserdetail?access_token=ACCESS_TOKEN', 'POST'],
|
||||
|
||||
'GET_TICKET': ['/cgi-bin/ticket/get?access_token=ACCESS_TOKEN', 'GET'],
|
||||
'GET_JSAPI_TICKET': ['/cgi-bin/get_jsapi_ticket?access_token=ACCESS_TOKEN', 'GET'],
|
||||
|
||||
'GET_CHECKIN_OPTION': ['/cgi-bin/checkin/getcheckinoption?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'GET_CHECKIN_DATA': ['/cgi-bin/checkin/getcheckindata?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'GET_APPROVAL_DATA': ['/cgi-bin/corp/getapprovaldata?access_token=ACCESS_TOKEN', 'POST'],
|
||||
|
||||
'GET_INVOICE_INFO': ['/cgi-bin/card/invoice/reimburse/getinvoiceinfo?access_token=ACCESS_TOKEN', 'POST'],
|
||||
'UPDATE_INVOICE_STATUS':
|
||||
['/cgi-bin/card/invoice/reimburse/updateinvoicestatus?access_token=ACCESS_TOKEN', 'POST'],
|
||||
|
@ -94,7 +80,8 @@ CORP_API_TYPE = {
|
|||
|
||||
|
||||
class WeWorkOps(AbstractApi):
|
||||
def __init__(self, corp_id=WEWORK_CORP_ID, agent_id=WEWORK_AGENT_ID, agent_secret=WEWORK_AGNET_SECRET, storage=cache_storage, prefix='wework'):
|
||||
def __init__(self, corp_id=WEWORK_CORP_ID, agent_id=WEWORK_AGENT_ID, agent_secret=WEWORK_AGNET_SECRET,
|
||||
storage=cache_storage, prefix='wework'):
|
||||
super().__init__()
|
||||
self.corp_id = corp_id
|
||||
self.agent_id = agent_id
|
||||
|
@ -172,38 +159,33 @@ class WeWorkOps(AbstractApi):
|
|||
临时授权码换取userinfo
|
||||
"""
|
||||
_status, ticket_data = self.get_user_ticket_by_code_with_oauth2(code)
|
||||
print('ticket_data ----------- ', ticket_data)
|
||||
# 判断 user_ticket 是否存在
|
||||
if not _status:
|
||||
context = {
|
||||
'msg': '获取userid失败,错误信息:{}'.format(ticket_data),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': '获取userid失败,错误信息:{}'.format(ticket_data),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return False, context, ticket_data
|
||||
|
||||
user_id = ticket_data.get('userid')
|
||||
if ticket_data.get('user_ticket') is None:
|
||||
context = {
|
||||
'msg': '获取用户Ticket失败,当前扫码用户[{}]可能未加入企业!'.format(user_id),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': '获取用户Ticket失败,当前扫码用户[{}]可能未加入企业!'.format(user_id),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return False, context, user_id
|
||||
|
||||
# 通过user_ticket获取企业微信用户详情信息
|
||||
detail_status, user_info = self.get_user_info_by_ticket_with_oauth2(ticket_data.get('user_ticket'))
|
||||
print("get_user_info_by_ticket_with_oauth2 --- ", user_info)
|
||||
if not detail_status:
|
||||
context = {
|
||||
'msg': '获取用户信息失败,错误信息:{}'.format(user_id),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
context = {'global_title': TITLE,
|
||||
'msg': '获取用户信息失败,错误信息:{}'.format(user_id),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return False, context
|
||||
return True, user_id, user_info
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
wx = WeWorkOps()
|
||||
print(wx.get_user_detail_by_user_id('XiangLe'))
|
||||
|
|
Loading…
Reference in New Issue