init
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pwdselfservice.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
|
@ -0,0 +1,30 @@
|
|||
# AD配置
|
||||
AD_HOST = 'abc.com'
|
||||
AD_LOGIN_USER = 'abc\pwdadmin'
|
||||
AD_LOGIN_USER_PWD = 'gVykWgNNF0oBQzwmwPp8'
|
||||
BASE_DN = 'OU=RD,DC=abc,DC=com'
|
||||
|
||||
# 钉钉配置
|
||||
# 钉钉统一接口地址,不可修改。
|
||||
DING_URL = "https://oapi.dingtalk.com/sns"
|
||||
|
||||
# 钉钉企业ID
|
||||
DING_CORP_ID = 'ding0176902811df32'
|
||||
|
||||
# 钉钉E应用
|
||||
DING_AGENT_ID = '25311eeee'
|
||||
DING_APP_KEY = 'dingqdzmax324v'
|
||||
DING_APP_SECRET = 'rnGRJhhw5kVmzykG9mrTDxewmI4e0myPAluMlguYQOaadsf2fhgfdfsx'
|
||||
|
||||
# 钉钉移动应用接入
|
||||
DING_SELF_APP_ID = 'dingoabrzugusdfdf33fgfds
|
||||
DING_SELF_APP_SECRET = 'IrH2MedSgesguFjGvFCTjXYBRZDhA5AI4ADQU5710sgLffdsadf32uhgfdsfs'
|
||||
|
||||
# Crypty key 通过generate_key生成,可不用修改,如果需要自行生成,请使用Crypto.generate_key自行生成,用于加密页面提交的明文密码
|
||||
CRYPTO_KEY = b'dp8U9y7NAhCD3MoNwPzPBhBtTZ1uI_WWSdpNs6wUDgs='
|
||||
|
||||
# COOKIE 超时,定义多长时间页面失效,单位秒。
|
||||
TMPID_COOKIE_AGE = 300
|
||||
|
||||
# 主页域名,index.html中的钉钉跳转等需要指定域名。
|
||||
HOME_URL = 'https://pwd.abc.com'
|
|
@ -0,0 +1,186 @@
|
|||
"""
|
||||
Django settings for pwdselfservice project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.1.8.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'nxnm3#&2tat_c2i6%$y74a)t$(3irh^gpwaleoja1kdv30fmcm'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
# 创建日志的路径
|
||||
LOG_PATH = os.path.join(BASE_DIR, 'log')
|
||||
# 如果地址不存在,则会自动创建log文件夹
|
||||
if not os.path.isdir(LOG_PATH):
|
||||
os.mkdir(LOG_PATH)
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,#此选项开启表示禁用部分日志,不建议设置为True
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
'format': '%(asctime)s %(levelname)s %(pathname)s %(module)s.%(funcName)s %(lineno)d: %(message)s'
|
||||
#日志格式
|
||||
},
|
||||
'simple': {
|
||||
'format': '%(asctime)s %(levelname)s %(pathname)s %(module)s.%(funcName)s %(lineno)d: %(message)s'
|
||||
},
|
||||
},
|
||||
'filters': {
|
||||
'require_debug_true': {
|
||||
'()': 'django.utils.log.RequireDebugTrue',#过滤器,只有当setting的DEBUG = True时生效
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'filters': ['require_debug_true'],
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'verbose'
|
||||
},
|
||||
'file': {#重点配置部分
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': '%s/log.log' % LOG_PATH,#日志保存文件
|
||||
'formatter': 'verbose'#日志格式,与上边的设置对应选择
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django': {#日志记录器
|
||||
'handlers': ['file'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# SESSION
|
||||
# 只有在settings.SESSION_SAVE_EVERY_REQUEST 为True时才有效
|
||||
SESSION_SAVE_EVERY_REQUEST = True
|
||||
# 过期时间分钟
|
||||
SESSION_COOKIE_AGE = 300
|
||||
# False 会话cookie可以在用户浏览器中保持有效期。True:关闭浏览器,则Cookie失效。
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||
# 建议配置,阻止 javascript 对会话数据的访问,提高安全性。
|
||||
# SESSION_COOKIE_HTTPONLY= True
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'resetpwd',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'pwdselfservice.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')]
|
||||
,
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'pwdselfservice.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'zh-hans'
|
||||
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = False
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = 'static'
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
from django.urls import path, include, re_path
|
||||
from django.views.generic.base import RedirectView
|
||||
from django.conf import urls
|
||||
import resetpwd.views
|
||||
from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = {
|
||||
# path('admin/', admin.site.urls)
|
||||
path("favicon.ico", RedirectView.as_view(url='static/img/favicon.ico')),
|
||||
path('', resetpwd.views.resetpwd_index, name='index'),
|
||||
path('resetcheck', resetpwd.views.resetpwd_check_userinfo, name='resetcheck'),
|
||||
path('resetpwd', resetpwd.views.resetpwd_reset, name='resetpwd'),
|
||||
path('resetunlock', resetpwd.views.resetpwd_unlock, name='resetunlock'),
|
||||
path('resetmsg', resetpwd.views.reset_msg, name='resetmsg'),
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
WSGI config for pwdselfservice project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pwdselfservice.settings')
|
||||
|
||||
application = get_wsgi_application()
|
|
@ -0,0 +1,117 @@
|
|||
## 需要的基础环境:
|
||||
* Python 3.6.x
|
||||
* Nginx(建议)
|
||||
* Uwsgi(建议)
|
||||
|
||||
## 钉钉必要条件:
|
||||
#### E应用配置
|
||||
* 在钉钉工作台中通过“自建应用”创建应用,选择“企业内部自主开发”,在应用首页中获取应用的AgentId、AppKey、AppSecret。
|
||||
* 应用需要权限:身份验证、消息通知、通讯录只读权限、手机号码信息、邮箱等个人信息、智能人事,范围是全部员工或自行选择
|
||||
* 应用安全域名和IP一定要配置,否则无法返回接口数据。
|
||||
|
||||
#### 移动接入应用:
|
||||
* 登录中开启扫码登录,配置回调域名:“https://pwd.abc.com/resetcheck”,其中pwd.abc.com请按自己实际域名来,并记录相关的appId、appSecret。
|
||||
|
||||
|
||||
## 按自己实际的配置修改项目配置参数:
|
||||
修改pwdselfservice/local_settings.py中的参数,按自己的实际参数修改
|
||||
|
||||
``` python
|
||||
# AD配置
|
||||
AD_HOST = 'abc.com'
|
||||
AD_LOGIN_USER = 'abc\pwdadmin'
|
||||
AD_LOGIN_USER_PWD = 'gVykWgNNF0oBQzwmwPp8'
|
||||
BASE_DN = 'OU=rd,DC=abc,DC=com'
|
||||
|
||||
# 钉钉配置
|
||||
# 钉钉统一接口地址,不可修改
|
||||
DING_URL = "https://oapi.dingtalk.com/sns"
|
||||
|
||||
# 钉钉企业ID
|
||||
DING_CORP_ID = 'ding01769028f06d321'
|
||||
|
||||
# 钉钉E应用
|
||||
DING_AGENT_ID = '25304321'
|
||||
DING_APP_KEY = 'dingqdzmn611l5321321'
|
||||
DING_APP_SECRET = 'rnGRJhhw5kVmzykG9mrTDxewmI4e0myP1123333221jzeKv3amQYWcInLV3x'
|
||||
|
||||
# 钉钉移动应用接入
|
||||
DING_SELF_APP_ID = 'dingoabr112233xts'
|
||||
DING_SELF_APP_SECRET = 'IrH2MedSgesguFjGvFCTjXYBRZD3322112233332211222
|
||||
|
||||
# Crypty key 通过Crypty.generate_key生成
|
||||
CRYPTO_KEY = b'dp8U9y7NAhCD3MoNwPzPBhBtTZ1uI_WWSdpNs6wUDgs='
|
||||
|
||||
# COOKIE 超时
|
||||
TMPID_COOKIE_AGE = 300
|
||||
|
||||
# 主页域名
|
||||
HOME_URL = 'https://pwd.abc.com'
|
||||
|
||||
```
|
||||
|
||||
|
||||
### 自行安装完python3之后,使用python3目录下的pip3进行安装依赖:
|
||||
### 我自行安装的Python路径为/usr/local/python3
|
||||
项目目录下的requestment文件里记录了所依赖的相关python模块,安装方法:
|
||||
* /usr/local/python3/bin/pip3 install -r requestment
|
||||
|
||||
等待所有模块安装完成之后进行下一步。
|
||||
|
||||
安装完依赖后,直接执行
|
||||
/usr/local/python3/bin/python3 manager.py runserver x.x.x.x:8000
|
||||
即可访问正常访问项目
|
||||
|
||||
## 通过uwsgi启动:
|
||||
/usr/local/python3/bin/uwsgi -d --ini /usr/loca/wwwroot/pwdselfservice/uwsgi.ini
|
||||
|
||||
其中/xxx/xxx/pwdselfservice/uwsgi.ini是你自己的服务器中此文件的真实地址
|
||||
|
||||
启动之后也可以通过IP+端口访问了。
|
||||
|
||||
提供2个脚本,让uwsgi在修改文件时能自动重载:
|
||||
|
||||
uwsgi-start.sh:
|
||||
```shell
|
||||
#!/bin/sh
|
||||
/usr/local/python3/bin/uwsgi -d --ini /usr/loca/wwwroot/pwdselfservice/uwsgi.ini --touch-reload "/usr/loca/wwwroot/pwdselfservice/reload.set"
|
||||
```
|
||||
|
||||
uwsgi-autoreload.sh:
|
||||
```shell
|
||||
#!/bin/sh
|
||||
objectdir="/usr/loca/wwwroot/pwdselfservice"
|
||||
|
||||
/usr/bin/inotifywait -mrq --exclude "(logs|\.swp|\.swx|\.log|\.pyc|\.sqlite3)" --timefmt '%d/%m/%y %H:%M' --format '%T %wf' --event modify,delete,move,create,attrib ${objectdir} | while read files
|
||||
do
|
||||
/bin/touch /usr/loca/wwwroot/pwdselfservice/reload.set
|
||||
continue
|
||||
done &
|
||||
```
|
||||
脚本内的路径按自己实际情况修改
|
||||
|
||||
## Nginx配置:
|
||||
|
||||
Nginx Server配置:
|
||||
* proxy_pass的IP地址改成自己的服务器IP
|
||||
* 配置可自己写一个vhost或直接加在nginx.conf中
|
||||
``` nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name pwd.abc.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://192.168.x.x:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
}
|
||||
access_log /var/log/nginx/vhost/pwd.log access;
|
||||
error_log /var/log/nginx/vhost/pwd.err error;
|
||||
}
|
||||
```
|
||||
|
||||
- 执行Nginx reload操作,重新加载配置
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Django==2.1.8
|
||||
dingtalk-sdk>=1.2.2
|
||||
pycrypto==2.6
|
||||
cryptography
|
||||
ldap3
|
||||
requests
|
||||
uwsgi
|
|
@ -0,0 +1,99 @@
|
|||
from ldap3 import *
|
||||
from pwdselfservice.local_settings import *
|
||||
|
||||
|
||||
def __ad_connect():
|
||||
username = str(AD_LOGIN_USER).lower()
|
||||
server = Server(host=AD_HOST, use_ssl=True, port=636, get_info='ALL')
|
||||
try:
|
||||
conn = Connection(server, auto_bind=True, user=username, password=AD_LOGIN_USER_PWD, authentication='NTLM')
|
||||
return conn
|
||||
except Exception:
|
||||
raise Exception('Server Error. Could not connect to Domain Controller')
|
||||
|
||||
|
||||
def ad_ensure_user_by_sam(username):
|
||||
"""
|
||||
通过sAMAccountName查询某个用户是否在AD中
|
||||
:param username: 除去@domain.com 的部分
|
||||
:return: True or False
|
||||
"""
|
||||
conn = __ad_connect()
|
||||
base_dn = BASE_DN
|
||||
condition = '(&(objectclass=person)(mail=' + username + '))'
|
||||
attributes = ['sAMAccountName']
|
||||
return conn.search(base_dn, condition, attributes=attributes)
|
||||
|
||||
|
||||
def ad_ensure_user_by_mail(user_mail_addr):
|
||||
"""
|
||||
通过mail查询某个用户是否在AD中
|
||||
:param user_mail_addr:
|
||||
:return: True or False
|
||||
"""
|
||||
conn = __ad_connect()
|
||||
base_dn = BASE_DN
|
||||
condition = '(&(objectclass=person)(mail=' + user_mail_addr + '))'
|
||||
attributes = ['mail']
|
||||
return conn.search(base_dn, condition, attributes=attributes)
|
||||
|
||||
|
||||
def ad_get_user_displayname_by_mail(user_mail_addr):
|
||||
conn = __ad_connect()
|
||||
conn.search(BASE_DN, '(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=[
|
||||
'displayName'])
|
||||
user_displayname = conn.entries[0]['displayName']
|
||||
conn.unbind()
|
||||
return user_displayname
|
||||
|
||||
|
||||
def ad_get_user_dn_by_mail(user_mail_addr):
|
||||
conn = __ad_connect()
|
||||
conn.search(BASE_DN,
|
||||
'(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=['distinguishedName'])
|
||||
user_dn = conn.entries[0]['distinguishedName']
|
||||
return user_dn
|
||||
|
||||
|
||||
def ad_get_user_status_by_mail(user_mail_addr):
|
||||
conn = __ad_connect()
|
||||
conn.search(BASE_DN,
|
||||
'(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=['userAccountControl'])
|
||||
user_account_control = conn.entries[0]['userAccountControl']
|
||||
return user_account_control
|
||||
|
||||
|
||||
def ad_unlock_user_by_mail(user_mail_addr):
|
||||
conn = __ad_connect()
|
||||
user_dn = ad_get_user_dn_by_mail(user_mail_addr)
|
||||
result = conn.extend.microsoft.unlock_account(user="%s" % user_dn)
|
||||
conn.unbind()
|
||||
return result
|
||||
|
||||
|
||||
def ad_reset_user_pwd_by_mail(user_mail_addr, new_password):
|
||||
conn = __ad_connect()
|
||||
user_dn = ad_get_user_dn_by_mail(user_mail_addr)
|
||||
result = conn.extend.microsoft.modify_password(user="%s" % user_dn, new_password="%s" % new_password)
|
||||
conn.unbind()
|
||||
return result
|
||||
|
||||
|
||||
def ad_modify_user_pwd_by_mail(user_mail_addr, old_password, new_password):
|
||||
conn = __ad_connect()
|
||||
user_dn = ad_get_user_dn_by_mail(user_mail_addr)
|
||||
result = conn.extend.microsoft.modify_password(user="%s" % user_dn, new_password="%s" % new_password,
|
||||
old_password="%s" % old_password)
|
||||
conn.unbind()
|
||||
return result
|
||||
|
||||
|
||||
def ad_get_user_locked_status_by_mail(user_mail_addr):
|
||||
conn = __ad_connect()
|
||||
conn.search(BASE_DN, '(&(objectclass=person)(mail=' + user_mail_addr + '))', attributes=['lockoutTime'])
|
||||
locked_status = conn.entries[0]['lockoutTime']
|
||||
print(locked_status)
|
||||
if '1601-01-01' in str(locked_status):
|
||||
return 0
|
||||
else:
|
||||
return locked_status
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ResetpwdConfig(AppConfig):
|
||||
name = 'resetpwd'
|
|
@ -0,0 +1,22 @@
|
|||
from cryptography.fernet import Fernet
|
||||
|
||||
|
||||
class Crypto(object):
|
||||
"""docstring for ClassName"""
|
||||
def __init__(self, key):
|
||||
self.factory = Fernet(key)
|
||||
|
||||
@staticmethod
|
||||
def generate_key():
|
||||
key = Fernet.generate_key()
|
||||
print(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
|
|
@ -0,0 +1,82 @@
|
|||
from dingtalk.client import *
|
||||
import requests
|
||||
from pwdselfservice.local_settings import *
|
||||
|
||||
|
||||
def ding_get_access_token():
|
||||
resp = requests.get(
|
||||
url=DING_URL + "/gettoken",
|
||||
params=dict(appid=DING_SELF_APP_ID, appsecret=DING_SELF_APP_SECRET)
|
||||
)
|
||||
resp = resp.json()
|
||||
if resp['access_token']:
|
||||
return resp['access_token']
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def ding_get_persistent_code(code, token):
|
||||
resp = requests.post(
|
||||
url="%s/get_persistent_code?access_token=%s" % (DING_URL, token),
|
||||
json=dict(tmp_auth_code=code),
|
||||
)
|
||||
resp = resp.json()
|
||||
if resp['unionid']:
|
||||
return resp['unionid']
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def ding_client_connect():
|
||||
client = AppKeyClient(corp_id=DING_CORP_ID, app_key=DING_APP_KEY, app_secret=DING_APP_SECRET)
|
||||
return client
|
||||
|
||||
|
||||
def ding_get_dept_user_list_detail(dept_id, offset, size):
|
||||
client = ding_client_connect()
|
||||
result = client.user.list(department_id=dept_id, offset=offset, size=size)
|
||||
return result
|
||||
|
||||
|
||||
def ding_get_userinfo_by_code(code):
|
||||
"""
|
||||
:param code: requestAuthCode接口中获取的CODE
|
||||
:return:
|
||||
"""
|
||||
client = ding_client_connect()
|
||||
resutl = client.user.getuserinfo(code)
|
||||
return resutl
|
||||
|
||||
|
||||
def ding_get_userid_by_unionid(unionid):
|
||||
"""
|
||||
:param unionid: 用户在当前钉钉开放平台账号范围内的唯一标识
|
||||
:return:
|
||||
"""
|
||||
client = ding_client_connect()
|
||||
resutl = client.user.get_userid_by_unionid(unionid)
|
||||
if resutl['userid']:
|
||||
return resutl['userid']
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def ding_get_org_user_count():
|
||||
"""
|
||||
企业员工数量
|
||||
only_active – 是否包含未激活钉钉的人员数量
|
||||
:return:
|
||||
"""
|
||||
client = ding_client_connect()
|
||||
resutl = client.user.get_org_user_count('only_active')
|
||||
return resutl
|
||||
|
||||
|
||||
def ding_get_userinfo_detail(user_id):
|
||||
"""
|
||||
user_id – 用户ID
|
||||
:return:
|
||||
"""
|
||||
client = ding_client_connect()
|
||||
resutl = client.user.get(user_id)
|
||||
return resutl
|
|
@ -0,0 +1,34 @@
|
|||
from django.forms import fields as c_fields
|
||||
from django import forms as c_forms
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
|
||||
class CheckForm(c_forms.Form):
|
||||
new_password = c_fields.RegexField(
|
||||
'(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}',
|
||||
# 密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位
|
||||
strip=True,
|
||||
min_length=8,
|
||||
max_length=30,
|
||||
error_messages={'required': '新密码不能为空.',
|
||||
'invalid': '密码必须包含数字,字母、特殊字符',
|
||||
'min_length': "密码长度不能小于8个字符",
|
||||
'max_length': "密码长度不能大于30个字符"}
|
||||
)
|
||||
old_password = c_fields.CharField(error_messages={'required': '确认密码不能为空'})
|
||||
ensure_password = c_fields.CharField(error_messages={'required': '确认密码不能为空'})
|
||||
user_email = c_fields.CharField(error_messages={'required': '邮箱不能为空', 'invalid': '邮箱格式错误'})
|
||||
|
||||
def clean(self):
|
||||
pwd0 = self.cleaned_data.get('old_password')
|
||||
pwd1 = self.cleaned_data.get('new_password')
|
||||
pwd2 = self.cleaned_data.get('ensure_password')
|
||||
if pwd1 == pwd2:
|
||||
pass
|
||||
elif pwd0 == pwd1:
|
||||
# 这里异常模块导入要放在函数里面,放到文件开头有时会报错,找不到
|
||||
from django.core.exceptions import ValidationError
|
||||
raise ValidationError('新旧密码不能一样')
|
||||
else:
|
||||
from django.core.exceptions import ValidationError
|
||||
raise ValidationError('新密码和确认密码输入不一致')
|
|
@ -0,0 +1,4 @@
|
|||
from django.db import models
|
||||
from django import forms
|
||||
from django.contrib import auth
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
from django.shortcuts import render, reverse, HttpResponsePermanentRedirect, redirect
|
||||
from django.http import *
|
||||
from django.contrib import messages
|
||||
from dingtalk import *
|
||||
from .models import *
|
||||
from .crypto import Crypto
|
||||
from .ad import ad_get_user_locked_status_by_mail, ad_unlock_user_by_mail, ad_reset_user_pwd_by_mail, \
|
||||
ad_get_user_status_by_mail, ad_ensure_user_by_mail, ad_modify_user_pwd_by_mail
|
||||
from .dingding import ding_get_userinfo_detail, ding_get_userid_by_unionid, ding_get_userinfo_by_code, \
|
||||
ding_get_persistent_code, ding_get_access_token
|
||||
from pwdselfservice.local_settings import *
|
||||
from .form import *
|
||||
|
||||
|
||||
class CustomPasswortValidator(object):
|
||||
|
||||
def __init__(self, min_length=1, max_length=30):
|
||||
self.min_length = min_length
|
||||
|
||||
def validate(self, password):
|
||||
special_characters = "[~\!@#\$%\^&\*\(\)_\+{}\":;'\[\]]"
|
||||
if not any(char.isdigit() for char in password):
|
||||
raise ValidationError(_('Password must contain at least %(min_length)d digit.') % {'min_length': self.min_length})
|
||||
if not any(char.isalpha() for char in password):
|
||||
raise ValidationError(_('Password must contain at least %(min_length)d letter.') % {'min_length': self.min_length})
|
||||
if not any(char in special_characters for char in password):
|
||||
raise ValidationError(_('Password must contain at least %(min_length)d special character.') % {'min_length': self.min_length})
|
||||
|
||||
def get_help_text(self):
|
||||
return ""
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -0,0 +1,382 @@
|
|||
from django.shortcuts import render
|
||||
from django.http import *
|
||||
from .crypto import Crypto
|
||||
from .ad import ad_get_user_locked_status_by_mail, ad_unlock_user_by_mail, ad_reset_user_pwd_by_mail, \
|
||||
ad_get_user_status_by_mail, ad_ensure_user_by_mail, ad_modify_user_pwd_by_mail
|
||||
from .dingding import ding_get_userinfo_detail, ding_get_userid_by_unionid, \
|
||||
ding_get_persistent_code, ding_get_access_token
|
||||
from pwdselfservice.local_settings import *
|
||||
from .form import CheckForm
|
||||
import logging
|
||||
|
||||
|
||||
msg_template = 'msg.html'
|
||||
home_url = HOME_URL
|
||||
logger = logging.getLogger('django')
|
||||
|
||||
def resetpwd_index(request):
|
||||
home_url = HOME_URL
|
||||
app_id = DING_SELF_APP_ID
|
||||
if request.method == 'GET':
|
||||
return render(request, 'index.html', locals())
|
||||
else:
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s' % (request.method, request.path))
|
||||
|
||||
if request.method == 'POST':
|
||||
check_form = CheckForm(request.POST)
|
||||
if check_form.is_valid():
|
||||
form_obj = check_form.cleaned_data
|
||||
user_email = form_obj.get("user_email")
|
||||
old_password = form_obj.get("old_password")
|
||||
new_password = form_obj.get("new_password")
|
||||
else:
|
||||
msg = check_form.as_p().errors
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,错误信息:%s' % (request.method, request.path, msg))
|
||||
context = {
|
||||
'msg': msg,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
if user_email and old_password and new_password:
|
||||
try:
|
||||
# 判断账号是否被锁定
|
||||
if ad_get_user_locked_status_by_mail(user_mail_addr=user_email) is not 0:
|
||||
context = {
|
||||
'msg': "此账号己被锁定,请先解锁账号。",
|
||||
'button_click': "window.history.back()",
|
||||
'button_display': "返回"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
if ad_get_user_status_by_mail(user_mail_addr=user_email) == 514 or ad_get_user_status_by_mail(
|
||||
user_mail_addr=user_email) == 66050:
|
||||
context = {
|
||||
'msg': "此账号状态为己禁用,请联系HR确认账号是否正确。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
else:
|
||||
try:
|
||||
result = ad_modify_user_pwd_by_mail(user_mail_addr=user_email, old_password=old_password,
|
||||
new_password=new_password)
|
||||
if result is True:
|
||||
context = {
|
||||
'msg': "密码己修改成功,请妥善保管密码。你可直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
else:
|
||||
context = {
|
||||
'msg': "密码未修改成功,请确认旧密码是否正确。",
|
||||
'button_click': "window.history.back()",
|
||||
'button_display': "返回"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
except IndexError:
|
||||
context = {
|
||||
'msg': "请确认邮箱账号[%s]是否正确?未能在Active Directory中检索到相关信息。" % user_email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except Exception as e:
|
||||
context = {
|
||||
'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
except IndexError:
|
||||
context = {
|
||||
'msg': "请确认邮箱账号[%s]是否正确?未能在Active Directory中检索到相关信息。" % user_email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except Exception as e:
|
||||
context = {
|
||||
'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
|
||||
'button_click': "window.history.back()",
|
||||
'button_display': "返回"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
else:
|
||||
context = {
|
||||
'msg': "用户名、旧密码、新密码参数不正确,请重新确认后输入。",
|
||||
'button_click': "window.history.back()",
|
||||
'button_display': "返回"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
else:
|
||||
context = {
|
||||
'msg': "请从主页进行修改密码操作或扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
def resetpwd_check_userinfo(request):
|
||||
code = request.GET.get('code')
|
||||
if code:
|
||||
logger.info('[成功] 请求方法:%s,请求路径:%s,CODE:%s' % (request.method, request.path, code))
|
||||
else:
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到CODE。' % (request.method, request.path))
|
||||
try:
|
||||
unionid = ding_get_persistent_code(code, ding_get_access_token())
|
||||
# unionid 在钉钉企业中是否存在
|
||||
if not unionid:
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到unionid。' % (request.method, request.path))
|
||||
context = {
|
||||
'msg': '未能在钉钉企业通讯录中检索到相关信息,请确认当前登录钉钉的账号已在企业中注册!',
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
ding_user_info = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))
|
||||
try:
|
||||
# 钉钉中此账号是否可用
|
||||
if ding_user_info['active']:
|
||||
crypto = Crypto(CRYPTO_KEY)
|
||||
unionid_cryto = crypto.encrypt(unionid)
|
||||
# 配置cookie,并重定向到重置密码页面。
|
||||
set_cookie = HttpResponseRedirect('resetpwd')
|
||||
set_cookie.set_cookie('tmpid', unionid_cryto, expires=TMPID_COOKIE_AGE)
|
||||
return set_cookie
|
||||
else:
|
||||
context = {
|
||||
'msg': '邮箱是[%s]的用户在钉钉中未激活或可能己离职' % ding_user_info['email'],
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except IndexError:
|
||||
context = {
|
||||
'msg': "用户不存在或己离职",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except Exception as e:
|
||||
logger.error('[异常] :%s' % str(e))
|
||||
|
||||
except KeyError:
|
||||
context = {
|
||||
'msg': "错误,钉钉临时Code己失效,请从主页重新扫码。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
logger.error('[异常] :%s' % str(KeyError))
|
||||
return render(request, msg_template, context)
|
||||
|
||||
except Exception as e:
|
||||
context = {
|
||||
'msg': "错误[%s],请与管理员联系." % str(e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
logger.error('[异常] :%s' % str(e))
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
def resetpwd_reset(request):
|
||||
global unionid_crypto
|
||||
if request.method == 'GET':
|
||||
try:
|
||||
unionid_crypto = request.COOKIES.get('tmpid')
|
||||
except Exception as e:
|
||||
logger.error('[异常] :%s' % str(e))
|
||||
if not unionid_crypto:
|
||||
logger.error('[异常] 请求方法:%s,请求路径:%s,未能拿到CODE或CODE己超时。' % (request.method, request.path))
|
||||
context = {
|
||||
'msg': "会话己超时,请重新扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
crypto = Crypto(CRYPTO_KEY)
|
||||
unionid = crypto.decrypt(unionid_crypto)
|
||||
user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
|
||||
if user_email:
|
||||
context = {
|
||||
'user_email': user_email,
|
||||
}
|
||||
return render(request, 'resetpwd.html', context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "%s 您好,企业钉钉中未能找到您账号的邮箱配置,请联系HR完善信息。" % ding_get_userinfo_detail(ding_get_userid_by_unionid(
|
||||
unionid))['name'],
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
elif request.method == 'POST':
|
||||
new_password = request.POST.get('new_password').strip()
|
||||
unionid_crypto = request.COOKIES.get('tmpid')
|
||||
if not unionid_crypto:
|
||||
context = {
|
||||
'msg': "会话己超时,请重新扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
crypto = Crypto(CRYPTO_KEY)
|
||||
unionid = crypto.decrypt(unionid_crypto)
|
||||
user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
|
||||
if ad_ensure_user_by_mail(user_mail_addr=user_email) is False:
|
||||
context = {
|
||||
'msg': "账号[%s]在AD中不存在,请确认当前钉钉扫码账号绑定的邮箱是否和您正在使用的邮箱一致?或者该邮箱账号己被禁用!\n猜测:您的邮箱是否是带有数字或其它字母区分?" % user_email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
if ad_get_user_status_by_mail(user_mail_addr=user_email) == 514 or ad_get_user_status_by_mail(
|
||||
user_mail_addr=user_email) == 66050:
|
||||
context = {
|
||||
'msg': "此账号状态为己禁用,请联系HR确认账号是否正确。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
try:
|
||||
result = ad_reset_user_pwd_by_mail(user_mail_addr=user_email, new_password=new_password)
|
||||
if result:
|
||||
# 重置密码并执行一次解锁,防止重置后账号还是锁定状态。
|
||||
ad_unlock_user_by_mail(user_email)
|
||||
context = {
|
||||
'msg': "密码己重置成功,请妥善保管。你可以点击返回主页或直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "密码未重置成功,确认密码是否满足AD的复杂性要求。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except IndexError:
|
||||
context = {
|
||||
'msg': "请确认邮箱账号[%s]是否正确?未能在AD中检索到相关信息。" % user_email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except Exception as e:
|
||||
context = {
|
||||
'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "请从主页开始进行操作。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
def resetpwd_unlock(request):
|
||||
if request.method == 'GET':
|
||||
unionid_crypto = request.COOKIES.get('tmpid')
|
||||
if not unionid_crypto:
|
||||
context = {
|
||||
'msg': "会话己超时,请重新扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
crypto = Crypto(CRYPTO_KEY)
|
||||
unionid = crypto.decrypt(unionid_crypto)
|
||||
user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
|
||||
context = {
|
||||
'user_email': user_email,
|
||||
}
|
||||
return render(request, 'resetpwd.html', context)
|
||||
|
||||
elif request.method == 'POST':
|
||||
unionid_crypto = request.COOKIES.get('tmpid')
|
||||
if not unionid_crypto:
|
||||
context = {
|
||||
'msg': "会话己超时,请重新扫码验证用户信息。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
crypto = Crypto(CRYPTO_KEY)
|
||||
unionid = crypto.decrypt(unionid_crypto)
|
||||
user_email = ding_get_userinfo_detail(ding_get_userid_by_unionid(unionid))['email']
|
||||
if ad_ensure_user_by_mail(user_mail_addr=user_email) is False:
|
||||
context = {
|
||||
'msg': "账号[%s]在AD中未能正确检索到,请确认当前钉钉扫码账号绑定的邮箱是否和您正在使用的邮箱一致?或者该邮箱账号己被禁用!\n猜测:您的邮箱是否是带有数字或其它字母区分?" %
|
||||
user_email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
try:
|
||||
result = ad_unlock_user_by_mail(user_email)
|
||||
if result:
|
||||
context = {
|
||||
'msg': "账号己解锁成功。你可以点击返回主页或直接关闭此页面!",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "账号未能解锁,请联系管理员确认该账号在AD的是否己禁用。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except IndexError:
|
||||
context = {
|
||||
'msg': "请确认邮箱账号[%s]是否正确?未能在AD中检索到相关信息。" % user_email,
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
except Exception as e:
|
||||
context = {
|
||||
'msg': "出现未预期的错误[%s],请与管理员联系~" % str(e),
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
else:
|
||||
context = {
|
||||
'msg': "请从主页开始进行操作。",
|
||||
'button_click': "window.location.href='%s'" % home_url,
|
||||
'button_display': "返回主页"
|
||||
}
|
||||
return render(request, msg_template, context)
|
||||
|
||||
|
||||
def reset_msg(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
|
||||
}
|
||||
return render(request, msg_template, context)
|
|
@ -0,0 +1,135 @@
|
|||
.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; }
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
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}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
*{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}
|
||||
}
|
||||
.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"}
|
||||
.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}
|
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1 @@
|
|||
"use strict";window.bubbly=function(t){var n=t||{},o=function(){return Math.random()},r=n.canvas||document.createElement("canvas"),e=r.width,a=r.height;null===r.parentNode&&(r.setAttribute("style","position:fixed;z-index:-1;left:0;top:0;min-width:100vw;min-height:100vh;"),e=r.width=window.innerWidth,a=r.height=window.innerHeight,document.body.appendChild(r));var i=r.getContext("2d");i.shadowColor=n.shadowColor||"#fff",i.shadowBlur=n.blur||4;var l=i.createLinearGradient(0,0,e,a);l.addColorStop(0,n.colorStart||"#2AE"),l.addColorStop(1,n.colorStop||"#17B");for(var c=n.bubbles||Math.floor(.02*(e+a)),u=[],d=0;d<c;d++)u.push({f:(n.bubbleFunc||function(){return"hsla(0, 0%, 100%, "+.1*o()+")"}).call(),x:o()*e,y:o()*a,r:(n.radiusFunc||function(){return 4+o()*e/25}).call(),a:(n.angleFunc||function(){return o()*Math.PI*2}).call(),v:(n.velocityFunc||function(){return.1+.5*o()}).call()});!function t(){if(null===r.parentNode)return cancelAnimationFrame(t);!1!==n.animate&&requestAnimationFrame(t),i.globalCompositeOperation="source-over",i.fillStyle=l,i.fillRect(0,0,e,a),i.globalCompositeOperation=n.compose||"lighter",u.forEach(function(t){i.beginPath(),i.arc(t.x,t.y,t.r,0,2*Math.PI),i.fillStyle=t.f,i.fill(),t.x+=Math.cos(t.a)*t.v,t.y+=Math.sin(t.a)*t.v,t.x-t.r>e&&(t.x=-t.r),t.x+t.r<0&&(t.x=e+t.r),t.y-t.r>a&&(t.y=-t.r),t.y+t.r<0&&(t.y=a+t.r)})}()};
|
|
@ -0,0 +1,85 @@
|
|||
$(function () {
|
||||
$(".content .con_right .left").click(function (e) {
|
||||
$(this).css({ "color": "#333333", "border-bottom": "2px solid #2e558e" });
|
||||
$(".content .con_right .right").css({ "color": "#999999", "border-bottom": "2px solid #dedede" });
|
||||
$(".content .con_right ul .con_r_left").css("display", "block");
|
||||
$(".content .con_right ul .con_r_right").css("display", "none");
|
||||
});
|
||||
|
||||
$(".content .con_right .right").click(function (e) {
|
||||
$(this).css({ "color": "#333333", "border-bottom": "2px solid #2e558e" });
|
||||
$(".content .con_right .left").css({ "color": "#999999", "border-bottom": "2px solid #dedede" });
|
||||
$(".content .con_right ul .con_r_right").css("display", "block");
|
||||
$(".content .con_right ul .con_r_left").css("display", "none");
|
||||
});
|
||||
|
||||
|
||||
$('#btn_modify').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} 大小写字母+数字
|
||||
regex_mail = new RegExp('^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$')
|
||||
regex_pwd = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}');
|
||||
if ($.trim($('#user_email').val()) === '') {
|
||||
alert('请输入邮箱账号');
|
||||
return false;
|
||||
} else if (!regex_mail.test($.trim($('#user_email').val()))) {
|
||||
alert('请输入正确的邮箱账号。\n');
|
||||
return false;
|
||||
} else if ($.trim($('#old_password').val()) === '') {
|
||||
alert('请输入旧密码');
|
||||
return false;
|
||||
} else if ($.trim($('#new_password').val()) === '') {
|
||||
alert('请输入新密码');
|
||||
return false;
|
||||
} else if ($.trim($('#new_password').val()) === '1qaz@WSX') {
|
||||
alert('密码1qaz@WSX为初始密码,禁止使用,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
|
||||
return false;
|
||||
} else if (!regex_pwd.test($.trim($('#new_password').val()))) {
|
||||
alert('密码不符合复杂度规则,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
|
||||
return false;
|
||||
} else if ($.trim($('#ensure_password').val()) === '') {
|
||||
alert('请再次输入新密码');
|
||||
return false;
|
||||
} else if ($.trim($('#new_password').val()) === $.trim($('#old_password').val())) {
|
||||
alert('新旧密码不能一样');
|
||||
return false;
|
||||
} else if ($.trim($('#ensure_password').val()) !== $.trim($('#new_password').val())) {
|
||||
alert('两次输入的新密码不一致');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn_reset').click(function () {
|
||||
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}');
|
||||
if ($.trim($('#user_email').val()) === '') {
|
||||
alert('请输入邮箱账号');
|
||||
return false;
|
||||
} else if (!regex_mail.test($.trim($('#user_email').val()))) {
|
||||
alert('请输入正确的邮箱账号。\n');
|
||||
return false;
|
||||
} else if ($.trim($('#new_password').val()) === '') {
|
||||
alert('请输入密码');
|
||||
return false;
|
||||
} else if ($.trim($('#ensure_password').val()) === '') {
|
||||
alert('请再次输入新密码');
|
||||
return false;
|
||||
} else if ($.trim($('#new_password').val()) === '1qaz@WSX') {
|
||||
alert('密码1qaz@WSX为初始密码,禁止使用,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。');
|
||||
return false;
|
||||
} else if (!regex_pwd.test($.trim($('#new_password').val()))) {
|
||||
alert('密码不符合复杂度规则,请重新输入新密码。\n密码必须同时包含大写、小写、数字和特殊字符其中三项且至少8位。\n例如:1qaz@WSX');
|
||||
return false;
|
||||
} else if ($.trim($('#ensure_password').val()) !== $.trim($('#new_password').val())) {
|
||||
alert('两次输入的新密码不一致');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
!function (window, document) {
|
||||
function d(a) {
|
||||
var e, c = document.createElement("iframe"),
|
||||
d = "https://login.dingtalk.com/login/qrcode.htm?goto=" + a.goto ;
|
||||
d += a.style ? "&style=" + encodeURIComponent(a.style) : "",
|
||||
d += a.href ? "&href=" + a.href : "",
|
||||
c.src = d,
|
||||
c.frameBorder = "0",
|
||||
c.allowTransparency = "true",
|
||||
c.scrolling = "no",
|
||||
c.width = a.width ? a.width + 'px' : "365px",
|
||||
c.height = a.height ? a.height + 'px' : "400px",
|
||||
e = document.getElementById(a.id),
|
||||
e.innerHTML = "",
|
||||
e.appendChild(c)
|
||||
}
|
||||
window.DDLogin = d
|
||||
}(window, document);
|
|
@ -0,0 +1,41 @@
|
|||
$(document).ready(function () {
|
||||
|
||||
|
||||
$(".official-plat ul li:first-child").hover(function () {
|
||||
$(".weixin").show();
|
||||
$(".weibo").hide();
|
||||
});
|
||||
$("li[title='点击打开官方微博']").hover(function () {
|
||||
$(".weixin").hide();
|
||||
$(".weibo").show();
|
||||
});
|
||||
|
||||
//href="#a_null"的统一设置为无效链接
|
||||
$("a[href='#a_null']").click(function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
//波浪动画
|
||||
$(function () {
|
||||
var marqueeScroll = function (id1, id2, id3, timer) {
|
||||
var $parent = $("#" + id1);
|
||||
var $goal = $("#" + id2);
|
||||
var $closegoal = $("#" + id3);
|
||||
$closegoal.html($goal.html());
|
||||
function Marquee() {
|
||||
if (parseInt($parent.scrollLeft()) - $closegoal.width() >= 0) {
|
||||
$parent.scrollLeft(parseInt($parent.scrollLeft()) - $goal.width());
|
||||
}
|
||||
else {
|
||||
$parent.scrollLeft($parent.scrollLeft() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(Marquee, timer);
|
||||
}
|
||||
var marqueeScroll1 = new marqueeScroll("marquee-box", "wave-list-box1", "wave-list-box2", 20);
|
||||
var marqueeScroll2 = new marqueeScroll("marquee-box3", "wave-list-box4", "wave-list-box5", 40);
|
||||
});
|
After Width: | Height: | Size: 54 KiB |
|
@ -0,0 +1,114 @@
|
|||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>密码自助服务</title>
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'css/login.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 src="//g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="pagewrap">
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="con_left" >
|
||||
<div style="margin: 0 auto; width:100%; height: 200px; line-height: 200px;" align="center" >
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 36px; width:100%; ">「域账号/邮箱」<small>密码自助平台</small></p>
|
||||
</div>
|
||||
<div style="margin: 0 auto; width:400px; height: 240px;">
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 16px; width:100%;
|
||||
">提示:新密码要求满足8至30位长度(不包含空格),至少包含大小写字母及数字组成。</p>
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 16px; width:100%;
|
||||
">如果密码己遗忘,可点击[重置/解锁],使用钉钉扫描验证后直接重置密码。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="con_right">
|
||||
<div class="con_r_top">
|
||||
<a href="javascript:" class="right" style="color: rgb(51, 51, 51); border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: rgb(46, 85, 142);">修改密码</a>
|
||||
<a href="javascript:" class="left" style="color: rgb(153, 153, 153); border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: rgb(222, 222, 222);">重置/解锁</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="con_r_right" style="display: block;">
|
||||
<form name="modifypwd" method="post" action="" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<div class="user">
|
||||
<div><span class="user-icon"></span>
|
||||
<input type="text" id="user_email" name="user_email" placeholder=" 输入邮箱(例如:user@abc.com)" value="">
|
||||
</div>
|
||||
<div><span class="mima-icon"></span>
|
||||
<input type="password" id="old_password" name="old_password"
|
||||
placeholder=" 输入旧密码" value="">
|
||||
</div>
|
||||
<div><span class="mima-icon"></span>
|
||||
<input type="password" id="new_password" name="new_password"
|
||||
placeholder=" 输入新密码" value="">
|
||||
</div>
|
||||
<div><span class="mima-icon"></span>
|
||||
<input type="password" id="ensure_password" name="ensure_password"
|
||||
placeholder=" 再次输入新密码" value="">
|
||||
</div>
|
||||
</div><br>
|
||||
<button id="btn_modify" type="submit">修改密码</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
<li class="con_r_left" style="display: none;">
|
||||
<div style="margin-top: -30px" class="erweima">
|
||||
<div style="width: 300px; height: 300px; margin: 0 auto" id="ding_code"></div>
|
||||
<script type="text/javascript">
|
||||
// 扫描之后需要跳转的域名,填写自己的修改密码的域名地址http或https
|
||||
var home_url = "{{ home_url }}";
|
||||
// 钉钉移动应用接入ID
|
||||
var appid = "{{ app_id }}";
|
||||
// 钉钉回调域名
|
||||
var url = encodeURIComponent(home_url + '/resetcheck');
|
||||
var goto = encodeURIComponent('https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=' + appid + '&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=' + url);
|
||||
var obj = DDLogin({
|
||||
id: "ding_code",
|
||||
goto: goto,
|
||||
style: "border:none;background-color:#FFFFFF;",
|
||||
width: "300",
|
||||
height: "300"
|
||||
});
|
||||
// 获取loginTmpCode
|
||||
const hanndleMessage = function (event) {
|
||||
let origin = event.origin;
|
||||
console.log("origin", event.origin)
|
||||
//判断是否来自ddLogin扫码事件。
|
||||
if (origin === "https://login.dingtalk.com") {
|
||||
let loginTmpCode = event.data;
|
||||
console.log("loginTmpCode", loginTmpCode);
|
||||
if (loginTmpCode) {
|
||||
location.href = "https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=" + appid + "&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=" + url + "&loginTmpCode=" + loginTmpCode;
|
||||
}
|
||||
}
|
||||
};
|
||||
if (typeof window.addEventListener !== 'undefined') {
|
||||
window.addEventListener('message', hanndleMessage, false);
|
||||
} else if (typeof window.attachEvent !== 'undefined') {
|
||||
window.attachEvent('onmessage', hanndleMessage);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<div style="height: 70px; margin-top: -30px">
|
||||
<p style="font-size: 18px; color: #2e558e" align="center">钉钉扫码验证用户信息</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
if (!!window.ActiveXObject || "ActiveXObject" in window)
|
||||
alert("您当前使用的浏览器为IE或IE内核,因为IE各种体验问题,本网站不对IE兼容。\n为能正常使用密码自助修改服务,请更换谷歌、火狐等非IE核心的浏览器。\n如果是360、Maxthon" +
|
||||
"等这类双核心浏览器,请切换至[极速模式]亦可。")
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body></html>
|
|
@ -0,0 +1,45 @@
|
|||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>密码自助服务</title>
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'css/login.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 style="overflow: hidden">
|
||||
<div class="pagewrap">
|
||||
<div class="main">
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="con_left" >
|
||||
<div style="margin: 0 auto; width:100%; height: 200px; line-height: 200px;" align="center" >
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 36px; width:100%; ">「域账号/邮箱」
|
||||
<small>密码自助平台</small></p>
|
||||
</div>
|
||||
<div style="margin: 0 auto; width:400px; height: 240px;">
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 16px; width:100%;
|
||||
">提示:新密码要求满足8至30位长度(不包含空格),至少包含大小写字母及数字组成。</p>
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 16px; width:100%;
|
||||
">如果密码己遗忘,可点击[重置/解锁],使用钉钉扫描验证后直接重置密码。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="con_right">
|
||||
<div class="con_r_top">
|
||||
<p class="right" style="color: rgb(51, 51, 51); border-bottom: 2px solid rgb(46, 85, 142);">提示</p>
|
||||
</div>
|
||||
<form name="msg" method="get" action="" autocomplete="off">
|
||||
<ul>
|
||||
<li class="con_r_right" style="display: block;">
|
||||
{% csrf_token %}
|
||||
<div class="user" style="height: 220px;">
|
||||
<p style="font-size: 16px;min-height: 1px; padding-left: 0; padding-right: 40px; margin:0">{{ msg }}</p>
|
||||
</div><br>
|
||||
<button id="btn_back" style="margin-top: 0" type="button" onclick="{{ button_click }}">{{ button_display }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body></html>
|
|
@ -0,0 +1,15 @@
|
|||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>密码自助服务</title>
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'css/login.css' %}">
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'css/load.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 style="overflow: hidden">
|
||||
|
||||
<form name="resetcheck" method="post" action="resetpwd" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
</body></html>
|
|
@ -0,0 +1,72 @@
|
|||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>密码自助服务</title>
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'css/login.css' %}">
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'css/load.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 style="overflow: hidden">
|
||||
<div class="pagewrap">
|
||||
<div class="main">
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
<div class="con_left" >
|
||||
<div style="margin: 0 auto; width:100%; height: 200px; line-height: 200px;" align="center" >
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 36px; width:100%; ">「域账号/邮箱」
|
||||
<small>密码自助平台</small></p>
|
||||
</div>
|
||||
<div style="margin: 0 auto; width:400px; height: 240px;">
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 16px; width:100%;
|
||||
">提示:新密码要求满足8至30位长度,包含大小写字母及数字。</p>
|
||||
<p style="margin: 0 auto; color: #fdfdfe; font-size: 16px; width:100%;
|
||||
">如果密码己遗忘,可点击[重置/解锁],使用钉钉扫描验证后直接重置密码。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="con_right">
|
||||
<div class="con_r_top">
|
||||
<p class="right" style="color: rgb(51, 51, 51); border-bottom: 2px solid rgb(46, 85, 142);">重置密码</p>
|
||||
<a href="javascript:" class="left" style="color: rgb(153, 153, 153); border-bottom-width:2px; border-bottom-style: solid; border-bottom-color: rgb(222, 222, 222);">解锁账号</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="con_r_right" style="display: block;">
|
||||
<form name="resetcheck" method="post" action="" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<div class="user">
|
||||
<div><span class="user-icon"></span>
|
||||
<input type="text" id="user_email" name="user_email" readonly placeholder="{{ user_email }}" value="{{ user_email }}">
|
||||
</div>
|
||||
<div><span class="mima-icon"></span>
|
||||
<input type="password" id="new_password" name="new_password"
|
||||
placeholder=" 输入新密码" value="">
|
||||
</div>
|
||||
<div><span class="mima-icon"></span>
|
||||
<input type="password" id="ensure_password" name="ensure_password" placeholder=" 再次输入新密码" value="">
|
||||
</div>
|
||||
</div><br>
|
||||
<p style="height: 20px">会话有效期5分钟,重密码会自动解锁被锁定的账号。</p>
|
||||
<button id="btn_reset" style="margin-top: 0" type="submit">重置密码</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
<li class="con_r_left" style="display: none;">
|
||||
<form name="resetunlock" method="post" action="resetunlock" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<div class="user" style="height: 168px">
|
||||
<div><span class="user-icon"></span>
|
||||
<input type="text" id="user_email" name="user_email" readonly placeholder="{{ user_email }}" value="{{ user_email }}">
|
||||
</div>
|
||||
<span class="msgs"></span>
|
||||
|
||||
</div><br>
|
||||
<p style="height: 20px">会话有效期5分钟</p>
|
||||
<button id="btn_unlock" style="margin-top: 0px" type="submit">解锁账号</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body></html>
|
|
@ -0,0 +1,27 @@
|
|||
[uwsgi]
|
||||
http-socket = 192.168.90.111:8000
|
||||
|
||||
chdir = /usr/local/wwwroot/pwdselfservice
|
||||
|
||||
module = pwdselfservice.wsgi:application
|
||||
|
||||
master = true
|
||||
|
||||
processes = 4
|
||||
|
||||
threads = 4
|
||||
|
||||
max-requests = 2000
|
||||
|
||||
chmod-socket = 755
|
||||
|
||||
vacuum = true
|
||||
|
||||
#设置缓冲
|
||||
post-buffering = 4096
|
||||
|
||||
#设置静态文件
|
||||
static-map = /static=/usr/local/wwwroot/pwdselfservice/static
|
||||
|
||||
#设置日志目录
|
||||
daemonize = /usr/local/wwwroot/log/uwsgi/uwsgi.log
|