Pārlūkot izejas kodu

国际化翻译

shimingxy 7 mēneši atpakaļ
vecāks
revīzija
167ea5da82

+ 7 - 0
maxkey-authentications/maxkey-authentication-core/src/main/java/org/dromara/maxkey/authn/session/Session.java

@@ -30,6 +30,13 @@ public class Session implements Serializable{
     
     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 LocalDateTime startTimestamp;

+ 2 - 0
maxkey-authentications/maxkey-authentication-provider-mgt/src/main/java/org/dromara/maxkey/authn/realm/AbstractAuthenticationRealm.java

@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.dromara.maxkey.authn.SignPrincipal;
 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.idm.Groups;
 import org.dromara.maxkey.entity.idm.UserInfo;
@@ -148,6 +149,7 @@ public abstract class AbstractAuthenticationRealm {
         historyLogin.setUsername(userInfo.getUsername());
         historyLogin.setDisplayName(userInfo.getDisplayName());
         historyLogin.setInstId(userInfo.getInstId());
+        historyLogin.setCategory(CATEGORY.MGMT);
         
         Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp());
         if(ipRegion != null) {

+ 2 - 0
maxkey-authentications/maxkey-authentication-provider/src/main/java/org/dromara/maxkey/authn/realm/AbstractAuthenticationRealm.java

@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.dromara.maxkey.authn.SignPrincipal;
 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.idm.Groups;
 import org.dromara.maxkey.entity.idm.UserInfo;
@@ -148,6 +149,7 @@ public abstract class AbstractAuthenticationRealm {
         historyLogin.setUsername(userInfo.getUsername());
         historyLogin.setDisplayName(userInfo.getDisplayName());
         historyLogin.setInstId(userInfo.getInstId());
+        historyLogin.setCategory(CATEGORY.SIGN);
         
         Region ipRegion =ipLocationParser.region(userInfo.getLastLoginIp());
         if(ipRegion != null) {

+ 10 - 0
maxkey-core/src/main/java/org/dromara/maxkey/entity/history/HistoryLogin.java

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

+ 4 - 1
maxkey-persistence/src/main/java/org/dromara/maxkey/persistence/repository/LoginHistoryRepository.java

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

+ 5 - 1
maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/en-US.json

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

+ 5 - 1
maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-CN.json

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

+ 5 - 1
maxkey-web-frontend/maxkey-web-mgt-app/src/assets/i18n/zh-TW.json

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

+ 26 - 0
maxkey-web-frontend/maxkey-web-mgt-app/src/assets/transform.js

@@ -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]);
+}