企业微信&钉钉扫描登录

企业微信&钉钉扫描登录
This commit is contained in:
MaxKey
2021-08-07 17:15:01 +08:00
parent 30546a3d9e
commit c8244038b9
13 changed files with 101 additions and 28 deletions

View File

@@ -36,8 +36,8 @@ PasswordPolicy.OLD_PASSWORD_MATCH=\u65b0\u5bc6\u7801\u4e0d\u80fd\u4e0e\u65e7\u5b
login.error.attempts={0}\u5c1d\u8bd5\u767b\u9646{1}\u6b21\u6570\u8fbe\u5230\u6700\u5927\u9650\u5236\uff0c\u8bf7\u7a0d\u540e\u518d\u767b\u9646.
login.error.locked=\u7528\u6237\u88ab\u9501\u5b9a.
login.error.inactive=\u7528\u6237\u975e\u6d3b\u52a8\u72b6\u6001.
login.error.password=\u767b\u5f55\u5bc6\u7801\u65e0\u6548.
login.error.username=\u7528\u6237\u540d\u65e0\u6548.
login.error.password=\u7528\u6237\u540D\u6216\u5bc6\u7801\u65e0\u6548.
login.error.username=\u7528\u6237\u540D\u6216\u5bc6\u7801\u65e0\u6548.
login.error.username.null=\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a.
login.error.email.null=\u767b\u5f55\u90ae\u7bb1\u4e0d\u80fd\u4e3a\u7a7a.
login.error.password.null=\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a.

View File

@@ -36,8 +36,8 @@ PasswordPolicy.OLD_PASSWORD_MATCH=new password match old password.
login.error.attempts={0} login attempts the maximum number of {1} times, please login later.
login.error.locked=The user is locked.
login.error.inactive=User inactive state.
login.error.password=Invalid password.
login.error.username=Invalid username.
login.error.password=Invalid username or password.
login.error.username=Invalid username or password.
login.error.username.null=username cannot be empty.
login.error.email.null=email cannot be empty.
login.error.password.null=Password cannot be empty.

View File

@@ -36,8 +36,8 @@ PasswordPolicy.OLD_PASSWORD_MATCH=\u65b0\u5bc6\u7801\u4e0d\u80fd\u4e0e\u65e7\u5b
login.error.attempts={0}\u5c1d\u8bd5\u767b\u9646{1}\u6b21\u6570\u8fbe\u5230\u6700\u5927\u9650\u5236\uff0c\u8bf7\u7a0d\u540e\u518d\u767b\u9646.
login.error.locked=\u7528\u6237\u88ab\u9501\u5b9a.
login.error.inactive=\u7528\u6237\u975e\u6d3b\u52a8\u72b6\u6001.
login.error.password=\u767b\u5f55\u5bc6\u7801\u65e0\u6548.
login.error.username=\u7528\u6237\u540d\u65e0\u6548.
login.error.password=\u7528\u6237\u540D\u6216\u5bc6\u7801\u65e0\u6548.
login.error.username=\u7528\u6237\u540D\u6216\u5bc6\u7801\u65e0\u6548.
login.error.username.null=\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a.
login.error.email.null=\u767b\u5f55\u90ae\u7bb1\u4e0d\u80fd\u4e3a\u7a7a.
login.error.password.null=\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a.

View File

@@ -194,7 +194,7 @@ maxkey.login.mfa.type=TimeBasedOtpAuthn
#enable social sign on
maxkey.login.socialsignon=true
#social sign on providers
maxkey.login.socialsignon.providers=gitee,wechatopen,sinaweibo,google,qq,dingtalk,microsoft,facebook
maxkey.login.socialsignon.providers=gitee,wechatopen,sinaweibo,google,qq,dingtalk,microsoft,facebook,workweixin
#Enable kerberos/SPNEGO
maxkey.login.kerberos=true
#wsFederation

View File

@@ -195,7 +195,7 @@ maxkey.login.mfa.type=TimeBasedOtpAuthn
#enable social sign on
maxkey.login.socialsignon=true
#social sign on providers
maxkey.login.socialsignon.providers=gitee,wechatopen,sinaweibo,google,qq,dingtalk,microsoft,facebook
maxkey.login.socialsignon.providers=gitee,wechatopen,sinaweibo,google,qq,dingtalk,microsoft,facebook,workweixin
#Enable kerberos/SPNEGO
maxkey.login.kerberos=true
#wsFederation
@@ -366,8 +366,8 @@ maxkey.socialsignon.wechatopen.sortorder=2
maxkey.socialsignon.workweixin.provider=workweixin
maxkey.socialsignon.workweixin.provider.name=\u4F01\u4E1A\u5fae\u4fe1
maxkey.socialsignon.workweixin.icon=images/social/wechat_enterprise.png
maxkey.socialsignon.workweixin.client.id=wx00d052e8f417f8f9
maxkey.socialsignon.workweixin.client.secret=lIy40iP0z4D65eJaWDNoe-vSlttmqY2WGJBygbM0TlY
maxkey.socialsignon.workweixin.client.id=ww61ca142e1fe5b8ca
maxkey.socialsignon.workweixin.client.secret=CfWEoALuKdSKzXiV-QWXeGSD5zPd6Svze3GR_gB5eFs
maxkey.socialsignon.workweixin.agent.id=1000002
maxkey.socialsignon.workweixin.account.id=id
maxkey.socialsignon.workweixin.sortorder=2

View File

@@ -52,6 +52,7 @@ login.text.login.mobile.validTime.unit=\u79d2
login.text.login.twofactor=\u5b89\u5168\u8ba4\u8bc1
login.text.login.normal=\u57fa\u672c\u8ba4\u8bc1
login.text.login.mobile=\u624B\u673A\u767B\u5F55
login.text.login.qrcode=\u626B\u7801\u767B\u5F55
login.text.username=\u7528\u6237\u540d
login.text.mobile=\u624B\u673A\u53F7\u7801

View File

@@ -52,6 +52,7 @@ login.text.login.mobile.validTime.unit=seconds
login.text.login.twofactor=Two-Factors
login.text.login.normal=Normal Login
login.text.login.mobile=Mobile Login
login.text.login.qrcode=QRCode Login
login.text.username=Username
login.text.mobile=Phone Number

View File

@@ -52,6 +52,7 @@ login.text.login.mobile.validTime.unit=\u79d2
login.text.login.twofactor=\u5b89\u5168\u8ba4\u8bc1
login.text.login.normal=\u57fa\u672c\u8ba4\u8bc1
login.text.login.mobile=\u624B\u673A\u767B\u5F55
login.text.login.qrcode=\u626B\u7801\u767B\u5F55
login.text.username=\u7528\u6237\u540d
login.text.mobile=\u624B\u673A\u53F7\u7801

View File

@@ -153,6 +153,8 @@
<#--todo:send captcha-->
captchaCountTimer=setInterval("getCaptchaCount()", 1000);
});
});
</script>
</head>
@@ -192,6 +194,11 @@
<@locale code="login.text.login.mobile"/>
</a>
</li>
<li id="qrcodelogin" class="switch_tab_class">
<a href="javascript:void(0);">
<@locale code="login.text.login.qrcode"/>
</a>
</li>
</ul>
</td>
</tr>
@@ -206,6 +213,10 @@
<div id="div_mobileLogin" >
<#include "loginmobile.ftl">
</div>
<div id="div_qrcodelogin">
<#include "loginworkweixin.ftl">
<#-- <#include "logindingtalk.ftl">-->
</div>
</td>
</tr>
<tr>

View File

@@ -0,0 +1,41 @@
<script src="https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script>
var dingtalkredirect_uri="";
<script type="text/javascript">
var handleMessage = function (event) {
var origin = event.origin;
console.log("origin", event.origin);
if( origin == "https://login.dingtalk.com" ) { //判断是否来自ddLogin扫码事件。
var loginTmpCode = event.data;
dingtalkredirect_uri = dingtalkredirect_uri+'&loginTmpCode='+loginTmpCode;
//获取到loginTmpCode后就可以在这里构造跳转链接进行跳转了
console.log("loginTmpCode", loginTmpCode);
console.log("dingtalkredirect_uri", dingtalkredirect_uri);
window.top.location.href = dingtalkredirect_uri;
}
};
if (typeof window.addEventListener != 'undefined') {
window.addEventListener('message', handleMessage, false);
} else if (typeof window.attachEvent != 'undefined') {
window.attachEvent('onmessage', handleMessage);
}
$(function(){
$("#qrcodelogin").on("click",function(){
$.get("<@base />/logon/oauth20/scanqrcode/dingtalk",function(data,status){
var url = encodeURIComponent(data.redirectUri);
var gotodingtalk = encodeURIComponent('https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid='+data.clientId+'&response_type=code&scope=snsapi_login&state='+data.state+'&redirect_uri='+url)
dingtalkredirect_uri = 'https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid='+data.clientId+'&response_type=code&scope=snsapi_login&state='+data.state+'&redirect_uri='+data.redirectUri;
console.log("dingtalkredirect_uri", dingtalkredirect_uri);
console.log("gotodingtalk", gotodingtalk);
var obj = DDLogin({
id:"div_qrcodelogin",//这里需要你在自己的页面定义一个HTML标签并设置id例如<div id="login_container"></div>或<span id="login_container"></span>
goto: gotodingtalk, //请参考注释里的方式
style: "border:none;background-color:#FFFFFF;",
width : "365",
height: "400"
});
$('#div_qrcodelogin').show();
});
});
});
</script>

View File

@@ -0,0 +1,18 @@
<script type="text/javascript" src="https://rescdn.qqmail.com/node/ww/wwopenmng/js/sso/wwLogin-1.0.0.js"></script>
<script type="text/javascript">
$(function(){
$("#qrcodelogin").on("click",function(){
$.get("<@base />/logon/oauth20/scanqrcode/workweixin",function(data,status){
window.WwLogin({
"id" : "div_qrcodelogin",
"appid" : data.clientId,
"agentid" : data.agentId,
"redirect_uri" :encodeURIComponent(data.redirectUri),
"state" : data.state,
"href" : "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7d2lkdGg6IDI1MHB4O30NCi5pbXBvd2VyQm94IC50aXRsZSB7ZGlzcGxheTogbm9uZTt9DQouaW1wb3dlckJveCAuaW5mbyB7d2lkdGg6IDI1MHB4O30NCi5zdGF0dXNfaWNvbiB7ZGlzcGxheTpub25lfQ0KLmltcG93ZXJCb3ggLnN0YXR1cyB7dGV4dC1hbGlnbjogY2VudGVyO30=",
});
$('#div_qrcodelogin').show();
});
});
});
</script>

View File

@@ -329,8 +329,8 @@ body{
vertical-align: top;
}
#normalLogin,#tfaLogin,#mobileLogin{
width :49%;
#normalLogin,#tfaLogin,#mobileLogin,#qrcodelogin{
width :33.3%;
}
#div_tfaLogin , #div_mobileLogin{

View File

@@ -38,22 +38,22 @@ $(function(){
}
});
/** switch_tab*/
$(".switch_tab_class").on("click",function(){
if($(".switch_tab_current").attr("id")==(this.id)){
return;
}
$(".switch_tab .switch_tab_class").removeClass("switch_tab_current");
$(this).addClass("switch_tab_current");
$(".switch_tab li").each(function(){
$("#"+$(this).attr("value")).hide();
});
$("#"+$(this).attr("value")).show();
if (typeof(switchTab) == "function"){
switchTab($(this).attr("value"));//user define after switch Tab
}
});
$(".switch_tab_class").on("click",function(){
if($(".switch_tab_current").attr("id")==(this.id)){
return;
}
$(".switch_tab .switch_tab_class").removeClass("switch_tab_current");
$(this).addClass("switch_tab_current");
$(".switch_tab li").each(function(){
$("#div_"+$(this).attr("id")).hide();
});
$("#div_"+$(this).attr("id")).show();
if (typeof(switchTab) == "function"){
switchTab($(this).attr("id"));//user define after switch Tab
}
});
//document forward
$.forward=function(config){