mirror of
https://github.com/capricornxl/ad-password-self-service.git
synced 2025-08-12 01:44:58 +08:00
移除auto-install.sh中的redis部署步骤
抽出应用中的授权验证跳转的代码,单独做成一个auth页面,可实现选择首页是进入修改密码,还是自动跳转重置页面 调整部分文件说明
This commit is contained in:
41
templates/auth.html
Normal file
41
templates/auth.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block headerjs %}<script type="text/javascript" src="{% static 'js/dingtalk.open.js' %}"></script>{% endblock %}
|
||||
{% block paneltitle %}请稍后,授权信息认证中{% endblock %}
|
||||
{% block middleblock %}
|
||||
{% endblock %}
|
||||
{% block footerjs %}
|
||||
<script src="{% static 'layui/layui.js' %}"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'layer'], function () {
|
||||
let layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
let re_url= ""
|
||||
let index_load = layer.load(1, {shade: 0.4});
|
||||
{% if app_type == 'DING' %}
|
||||
dd.ready(() => {
|
||||
dd.runtime.permission.requestAuthCode({corpId: '{{ corp_id }}'}).then((result) => {
|
||||
re_url = '/resetPassword?code=' + result.code
|
||||
window.parent.parent.location.href=re_url;
|
||||
}).catch(err => {
|
||||
layer.close(index_load)
|
||||
layer.open({
|
||||
title : '出错啦!'
|
||||
,content: err
|
||||
,btn: '关闭'
|
||||
,btnAlign: 'c'
|
||||
,yes: function(){
|
||||
layer.closeAll();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
{% elif app_type == 'WEWORK' %}
|
||||
$(function () {
|
||||
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.parent.parent.location.href=re_url;
|
||||
})
|
||||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@@ -34,7 +34,7 @@
|
||||
</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>
|
||||
<a class="layui-text" id="redirect_url" href="/auth"><i class="layui-icon layui-icon-refresh-3"></i> 重置/解锁账号</a>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
@@ -53,39 +53,7 @@
|
||||
<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}$/,
|
||||
@@ -94,14 +62,11 @@ layui.use(['form', 'jquery', 'layer'], function () {
|
||||
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 %}
|
||||
|
@@ -28,7 +28,7 @@
|
||||
</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" 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>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
</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" 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>
|
||||
|
Reference in New Issue
Block a user