mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	优化系统用户登录校验
This commit is contained in:
		@@ -30,7 +30,7 @@ func (this *TokenAction) RunGet(params struct {
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	// 没有登录,则限制请求速度
 | 
			
		||||
	if params.Auth.AdminId() <= 0 && lastTimestamp > 0 && time.Now().Unix()-lastTimestamp <= 1 {
 | 
			
		||||
	if params.Auth.AdminId() <= 0 && lastTimestamp > 0 && time.Now().Unix()-lastTimestamp <= 0 {
 | 
			
		||||
		this.Fail("请求速度过快,请稍后刷新后重试")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package servers
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
 | 
			
		||||
@@ -136,6 +137,15 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 用户
 | 
			
		||||
		var userMap maps.Map = nil
 | 
			
		||||
		if server.User != nil {
 | 
			
		||||
			userMap = maps.Map{
 | 
			
		||||
				"id":       server.User.Id,
 | 
			
		||||
				"fullname": server.User.Fullname,
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		serverMaps = append(serverMaps, maps.Map{
 | 
			
		||||
			"id":   server.Id,
 | 
			
		||||
			"isOn": server.IsOn,
 | 
			
		||||
@@ -149,6 +159,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
			"groups":           groupMaps,
 | 
			
		||||
			"serverNames":      serverNames,
 | 
			
		||||
			"countServerNames": countServerNames,
 | 
			
		||||
			"user":             userMap,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["servers"] = serverMaps
 | 
			
		||||
@@ -178,5 +189,8 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["groups"] = groupMaps
 | 
			
		||||
 | 
			
		||||
	// 是否有用户管理权限
 | 
			
		||||
	this.Data["canVisitUser"] = configloaders.AllowModule(this.AdminId(), configloaders.AdminModuleCodeUser)
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user