国际化翻译

This commit is contained in:
shimingxy 2024-11-29 15:16:33 +08:00
parent 5a0465d079
commit 167ea5da82
9 changed files with 66 additions and 4 deletions

View File

@ -30,6 +30,13 @@ public class Session implements Serializable{
public static final int MAX_EXPIRY_DURATION = 60 * 5; //default 5 minutes. public static final int MAX_EXPIRY_DURATION = 60 * 5; //default 5 minutes.
public class CATEGORY{
public static final int SIGN = 1;
public static final int MGMT = 5;
}
public String id; public String id;
public LocalDateTime startTimestamp; public LocalDateTime startTimestamp;

View File

@ -22,6 +22,7 @@ import java.util.List;
import org.dromara.maxkey.authn.SignPrincipal; import org.dromara.maxkey.authn.SignPrincipal;
import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService; import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService;
import org.dromara.maxkey.authn.session.Session.CATEGORY;
import org.dromara.maxkey.entity.history.HistoryLogin; import org.dromara.maxkey.entity.history.HistoryLogin;
import org.dromara.maxkey.entity.idm.Groups; import org.dromara.maxkey.entity.idm.Groups;
import org.dromara.maxkey.entity.idm.UserInfo; import org.dromara.maxkey.entity.idm.UserInfo;
@ -148,6 +149,7 @@ public abstract class AbstractAuthenticationRealm {
historyLogin.setUsername(userInfo.getUsername()); historyLogin.setUsername(userInfo.getUsername());
historyLogin.setDisplayName(userInfo.getDisplayName()); historyLogin.setDisplayName(userInfo.getDisplayName());
historyLogin.setInstId(userInfo.getInstId()); historyLogin.setInstId(userInfo.getInstId());
historyLogin.setCategory(CATEGORY.MGMT);
Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp()); Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp());
if(ipRegion != null) { if(ipRegion != null) {

View File

@ -22,6 +22,7 @@ import java.util.List;
import org.dromara.maxkey.authn.SignPrincipal; import org.dromara.maxkey.authn.SignPrincipal;
import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService; import org.dromara.maxkey.authn.realm.ldap.LdapAuthenticationRealmService;
import org.dromara.maxkey.authn.session.Session.CATEGORY;
import org.dromara.maxkey.entity.history.HistoryLogin; import org.dromara.maxkey.entity.history.HistoryLogin;
import org.dromara.maxkey.entity.idm.Groups; import org.dromara.maxkey.entity.idm.Groups;
import org.dromara.maxkey.entity.idm.UserInfo; import org.dromara.maxkey.entity.idm.UserInfo;
@ -148,6 +149,7 @@ public abstract class AbstractAuthenticationRealm {
historyLogin.setUsername(userInfo.getUsername()); historyLogin.setUsername(userInfo.getUsername());
historyLogin.setDisplayName(userInfo.getDisplayName()); historyLogin.setDisplayName(userInfo.getDisplayName());
historyLogin.setInstId(userInfo.getInstId()); historyLogin.setInstId(userInfo.getInstId());
historyLogin.setCategory(CATEGORY.SIGN);
Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp()); Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp());
if(ipRegion != null) { if(ipRegion != null) {

View File

@ -49,6 +49,8 @@ public class HistoryLogin extends JpaEntity implements Serializable{
@Column @Column
String sessionId; String sessionId;
@Column @Column
int category;
@Column
String userId; String userId;
@Column @Column
String username; String username;
@ -112,6 +114,14 @@ public class HistoryLogin extends JpaEntity implements Serializable{
this.sessionId = sessionId; this.sessionId = sessionId;
} }
public int getCategory() {
return category;
}
public void setCategory(int category) {
this.category = category;
}
public String getUserId() { public String getUserId() {
return userId; return userId;
} }

View File

@ -32,6 +32,7 @@ public class LoginHistoryRepository {
insert into mxk_history_login insert into mxk_history_login
( id , ( id ,
sessionid , sessionid ,
category ,
userid , userid ,
username , username ,
displayname , displayname ,
@ -49,7 +50,7 @@ public class LoginHistoryRepository {
application , application ,
sessionstatus , sessionstatus ,
instid) instid)
values( ? , ? , ? , ? , ? , ? , ? , ?, ? , ? , ? , ?, ?, ? , ? , ?, ? , ? , ?) values( ? , ? , ? , ? , ? , ? , ? , ?, ? , ? , ? , ?, ?, ? , ? , ?, ? , ? , ? , ?)
"""; """;
protected JdbcTemplate jdbcTemplate; protected JdbcTemplate jdbcTemplate;
@ -84,6 +85,7 @@ public class LoginHistoryRepository {
new Object[] { new Object[] {
historyLogin.getId(), historyLogin.getId(),
historyLogin.getSessionId(), historyLogin.getSessionId(),
historyLogin.getCategory(),
historyLogin.getUserId(), historyLogin.getUserId(),
historyLogin.getUsername(), historyLogin.getUsername(),
historyLogin.getDisplayName(), historyLogin.getDisplayName(),
@ -105,6 +107,7 @@ public class LoginHistoryRepository {
new int[] { new int[] {
Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR,
Types.INTEGER,
Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR,

View File

@ -75,9 +75,13 @@
"monthAccessCount": "30 Day Access Count", "monthAccessCount": "30 Day Access Count",
"monthAppCount": "30 Day TOP 10 App Access Count", "monthAppCount": "30 Day TOP 10 App Access Count",
"monthBrowserCount": "30 Day TOP 10 Browser Access Count", "monthBrowserCount": "30 Day TOP 10 Browser Access Count",
"monthProvinceAccessCount": "30 Day TOP 10 Province Access Count",
"appName": "App", "appName": "App",
"browser": "Browser", "browser": "Browser",
"accessCount": "Count" "accessCount": "Count",
"number": "Number",
"province": "Province",
"accessPV": "Access(PV)"
}, },
"users": { "users": {
"tab.basic": "Basic", "tab.basic": "Basic",

View File

@ -74,9 +74,13 @@
"monthAccessCount": "30日访问情况统计", "monthAccessCount": "30日访问情况统计",
"monthAppCount": "30日TOP10应用访问统计", "monthAppCount": "30日TOP10应用访问统计",
"monthBrowserCount": "30日TOP10浏览器访问统计", "monthBrowserCount": "30日TOP10浏览器访问统计",
"monthProvinceAccessCount": "30日TOP10各省份访问统计",
"appName": "应用名称", "appName": "应用名称",
"browser": "浏览器", "browser": "浏览器",
"accessCount": "访问量" "accessCount": "访问量",
"number": "序号",
"province": "省份",
"accessPV": "浏览量(PV)"
}, },
"users": { "users": {
"tab.basic": "基本信息", "tab.basic": "基本信息",

View File

@ -75,9 +75,13 @@
"monthAccessCount": "30日訪問情況統計", "monthAccessCount": "30日訪問情況統計",
"monthAppCount": "30日TOP10應用訪問統計", "monthAppCount": "30日TOP10應用訪問統計",
"monthBrowserCount": "30日TOP10瀏覽器訪問統計", "monthBrowserCount": "30日TOP10瀏覽器訪問統計",
"monthProvinceAccessCount": "30日TOP10各省份訪問統計",
"appName": "應用名稱", "appName": "應用名稱",
"browser": "瀏覽器", "browser": "瀏覽器",
"accessCount": "訪問量" "accessCount": "訪問量",
"number": "序號",
"province": "省份",
"accessPV": "瀏覽量(PV)"
}, },
"users": { "users": {
"tab.basic": "基本信息", "tab.basic": "基本信息",

View File

@ -0,0 +1,26 @@
/*
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* /passport/trust/auth--->/#/passport/trust/auth
*/
function locationTransform(transPath){
var topHref = top.location.href;
if(topHref.indexOf('#') <= 0){
var loginIndex = topHref.indexOf(transPath);
if(loginIndex >- 1){
topHref = topHref.substring(0,loginIndex) + '/#' + topHref.substring(loginIndex);
top.location.href = topHref;
}
}
}
var transPaths = [
'/passport/trust/auth'
];
for (i = 0; i < transPaths.length; i++) {
locationTransform(transPaths[i]);
}