提交 e44766b1 编写于 作者: MaxKey单点登录官方's avatar MaxKey单点登录官方

login.js

上级 44aedebb
......@@ -12,7 +12,7 @@
*(MAXKEY-210811) 密码修改问题修复
*(MAXKEY-210812) 环境变量参数优化
*(MAXKEY-210813) 管理端图标显示修复
*(MAXKEY-210814) 管理端‘应用管理’移动到‘配置管理’的菜单项
*(MAXKEY-210814) 认证系统菜单项调整
*(MAXKEY-210815) OAuth的数据库加载增加本地缓存
*(MAXKEY-210816) 社交账号登录改为存储在数据库中,方便用户更改
*(MAXKEY-210817) 账号策略管理及动态适配
......@@ -21,13 +21,15 @@
*(MAXKEY-210820) 企业微信扫码登录js更新wwLogin-1.2.4.js
*(MAXKEY-210821) 中文切换调整为下拉菜单
*(MAXKEY-210822) 移除原有的缓存方案
*(MAXKEY-210823) 应用管理OAuth适配器显示问题修复
*(MAXKEY-210823) 应用管理OAuth适配器显示问题修复
*(MAXKEY-210824) 图片验证码优化,增加随机颜色的字符生成实现,干扰线优化
*(MAXKEY-210825) 依赖jar引用、更新和升级
*(MAXKEY-210825) 菜单名称的调整
*(MAXKEY-210826) JS脚本整合优化
*(MAXKEY-210827) 依赖jar引用、更新和升级
spring 5.3.12
springboot 2.5.6
tomcat 9.0.54
springSecurity 5.5.3
springSecurity 5.5.3
springData 2.5.5
springSession 2.5.3
mybatis-jpa-extra 2.6
......
<!-- javascript js begin -->
<script type="text/javascript">var webContextPath = "<@base />";var webLocale = '<@locale/>';</script>
<script type="text/javascript">var webContextPath = "<@base />";var webLocale = '<@locale/>';var currentDate= new Date('${.now}');</script>
<#-- jquery base -->
<script src ="<@base />/static/javascript/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src ="<@base />/static/javascript/popper.min.js" type="text/javascript" ></script>
......
......@@ -3,12 +3,7 @@
<head>
<#include "layout/header.ftl">
<#include "layout/common.cssjs.ftl">
<style>
.wrapper { position: relative; }
i.fa { position: absolute; top: 5px; left: 5px; font-size: 22px; color: gray;}
.wrapper input { text-indent: 20px;}
</style>
<script src ="<@base />/static/javascript/login.js" type="text/javascript" ></script>
<#if true==isKerberos>
<@browser name="MSIE">
......@@ -25,138 +20,6 @@
</script>
</@browser>
</#if>
<script type="text/javascript">
<#--resend captcha code Interval-->
var captchaCountTimer;
var captchaCount=60;
function getCaptchaCount(){
$("#mobile_j_otp_captcha_button").val("<@locale code="login.text.login.mobile.obtain.valid"/>("+captchaCount+")<@locale code="login.text.login.mobile.obtain.valid.unit"/>");
captchaCount--;
if(captchaCount==0){
$("#mobile_j_otp_captcha_button").val("<@locale code="login.text.login.mobile.obtain"/>");
captchaCount=60;
clearInterval(captchaCountTimer);
}
}
<#--current datetime-->
var currentDate= new Date('${.now}');
var fullYear=currentDate.getFullYear();
var month=currentDate.getMonth()+1;
var date=currentDate.getDate();
var hours=currentDate.getHours();
var minutes=currentDate.getMinutes();
var seconds=currentDate.getSeconds();
var strTime="";
function formatTime(){
strTime=fullYear+"-";
strTime+=(month<10?"0"+month:month)+"-";
strTime+=(date<10?"0"+date:date)+" ";
strTime+=(hours<10?"0"+hours:hours)+":";
strTime+=(minutes<10?"0"+minutes:minutes)+":";
strTime+=(seconds<10?"0"+seconds:seconds);
}
<#if true==isMfa && "TOPT"==otpType>
function currentTime(){
seconds++;
if(seconds>59){
minutes++;
seconds=0;
}
if(minutes>59){
hours++;
minutes=0;
}
if(hours>23){
date++;
hours=0;
}
formatTime();
//for timebase token
getTimeBaseCount();
$("#currentTime").val(strTime);
}
<#--timeBase Token Interval default is 30s-->
var timeBaseCount;
function getTimeBaseCount(){
if(seconds<${otpInterval}){
timeBaseCount=${otpInterval}-seconds;
}else{
timeBaseCount=${otpInterval}-(seconds-${otpInterval});
}
$("#tfa_j_otp_captcha_button").val("<@locale code="login.text.login.twofactor.validTime"/>("+timeBaseCount+")<@locale code="login.text.login.twofactor.validTime.unit"/>");
};
</#if>
var currentSwitchTab="normalLogin";
<#--submit form-->
function doLoginSubmit(){
$.cookie("mxk_login_username", $("#"+currentSwitchTab+"Form input[name=username]").val(), { expires: 7 });
$("#"+currentSwitchTab+"SubmitButton").click();
$.cookie("mxk_login_switch_tab", currentSwitchTab, { expires: 7 });
};
<#--switch Login Form-->
function switchTab(id){
if($("#"+id+"Form input[name=username]").val()==""){
$("#"+id+"Form input[name=username]").focus();
}else{
$("#"+id+"Form input[name=password]").focus();
}
currentSwitchTab=id;
}
<#-- when press ENTER key,do form submit-->
document.onkeydown=function(event){
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode==13){
doLoginSubmit();
};
};
$(function(){
<#if true==isMfa && "TOPT"==otpType>
setInterval("currentTime()", 1000);
</#if>
<#--submit loginForme-->
$(".doLoginSubmit").on("click",function(){
doLoginSubmit();
});
var cookieLoginUsername = $.cookie("mxk_login_username");
<#--read username cookie for login e-->
if(cookieLoginUsername != undefined && cookieLoginUsername != ""){
var switch_tab=$.cookie("mxk_login_switch_tab")==undefined ? "normalLogin" : $.cookie("mxk_login_switch_tab");
$("#"+switch_tab).click();
$("#"+switch_tab+"Form input[name=username]").val(cookieLoginUsername ==undefined ? "" : cookieLoginUsername);
$("#div_"+switch_tab+" input[name=password]").focus();
}else{
$("#div_normalLogin input[name=username]").focus();
}
<#--resend captchae-->
$("#mobile_j_otp_captcha_button").on("click",function(){
if(captchaCount<60){
return;
}
var loginName = $("#mobile_j_username").val();
if(loginName == ""){
return;
}
$.get("<@base />/login/sendsms/"+loginName,function(data,status){
//alert("Data: " + data + "\nStatus: " + status);
});
<#--todo:send captcha-->
captchaCountTimer=setInterval("getCaptchaCount()", 1000);
});
});
</script>
</head>
<body >
<div id="top">
......
......@@ -380,4 +380,27 @@ body{
.float-left{
float: left;
}
\ No newline at end of file
}
#div_normalLogin .wrapper ,
#div_tfaLogin .wrapper ,
#div_mobileLogin .wrapper{
position: relative;
}
#div_normalLogin .wrapper input,
#div_tfaLogin .wrapper input,
#div_mobileLogin .wrapper input {
text-indent: 20px;
}
#div_normalLogin .wrapper i.fa,
#div_tfaLogin .wrapper i.fa,
#div_mobileLogin .wrapper i.fa{
position: absolute;
top: 5px;
left: 5px;
font-size: 22px;
color: gray;
}
var captchaCountTimer;
var captchaCount=60;
function getCaptchaCount(){
$("#mobile_j_otp_captcha_button").val("重新获取("+captchaCount+")秒");
captchaCount--;
if(captchaCount==0){
$("#mobile_j_otp_captcha_button").val("发送验证码");
captchaCount=60;
clearInterval(captchaCountTimer);
}
}
var fullYear=currentDate.getFullYear();
var month=currentDate.getMonth()+1;
var date=currentDate.getDate();
var hours=currentDate.getHours();
var minutes=currentDate.getMinutes();
var seconds=currentDate.getSeconds();
var strTime="";
function formatTime(){
strTime=fullYear+"-";
strTime+=(month<10?"0"+month:month)+"-";
strTime+=(date<10?"0"+date:date)+" ";
strTime+=(hours<10?"0"+hours:hours)+":";
strTime+=(minutes<10?"0"+minutes:minutes)+":";
strTime+=(seconds<10?"0"+seconds:seconds);
}
function currentTime(){
seconds++;
if(seconds>59){
minutes++;
seconds=0;
}
if(minutes>59){
hours++;
minutes=0;
}
if(hours>23){
date++;
hours=0;
}
formatTime();
//for timebase token
getTimeBaseCount();
$("#currentTime").val(strTime);
}
var timeBaseCount;
function getTimeBaseCount(){
if(seconds<30){
timeBaseCount=30-seconds;
}else{
timeBaseCount=30-(seconds-30);
}
$("#tfa_j_otp_captcha_button").val("剩余时间("+timeBaseCount+")秒");
};
var currentSwitchTab="normalLogin";
function doLoginSubmit(){
$.cookie("mxk_login_username", $("#"+currentSwitchTab+"Form input[name=username]").val(), { expires: 7 });
$("#"+currentSwitchTab+"SubmitButton").click();
$.cookie("mxk_login_switch_tab", currentSwitchTab, { expires: 7 });
};
function switchTab(id){
if($("#"+id+"Form input[name=username]").val()==""){
$("#"+id+"Form input[name=username]").focus();
}else{
$("#"+id+"Form input[name=password]").focus();
}
currentSwitchTab=id;
}
document.onkeydown=function(event){
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode==13){
doLoginSubmit();
};
};
$(function(){
//setInterval("currentTime()", 1000);
$(".doLoginSubmit").on("click",function(){
doLoginSubmit();
});
var cookieLoginUsername = $.cookie("mxk_login_username");
if(cookieLoginUsername != undefined && cookieLoginUsername != ""){
var switch_tab=$.cookie("mxk_login_switch_tab")==undefined ? "normalLogin" : $.cookie("mxk_login_switch_tab");
$("#"+switch_tab).click();
$("#"+switch_tab+"Form input[name=username]").val(cookieLoginUsername ==undefined ? "" : cookieLoginUsername);
$("#div_"+switch_tab+" input[name=password]").focus();
}else{
$("#div_normalLogin input[name=username]").focus();
}
$("#mobile_j_otp_captcha_button").on("click",function(){
if(captchaCount<60){
return;
}
var loginName = $("#mobile_j_username").val();
if(loginName == ""){
return;
}
$.get(webContextPath +"/login/sendsms/"+loginName,function(data,status){
//alert("Data: " + data + "\nStatus: " + status);
});
captchaCountTimer=setInterval("getCaptchaCount()", 1000);
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册