This commit is contained in:
parent
c7a56b1dde
commit
4fa123baa8
@ -3,6 +3,7 @@ package api
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"wireguard-ui/component"
|
"wireguard-ui/component"
|
||||||
"wireguard-ui/http/param"
|
"wireguard-ui/http/param"
|
||||||
@ -77,6 +78,10 @@ func (DashboardApi) ConnectionList(c *gin.Context) {
|
|||||||
for _, iaip := range peer.AllowedIPs {
|
for _, iaip := range peer.AllowedIPs {
|
||||||
ipAllocation += iaip.String() + ","
|
ipAllocation += iaip.String() + ","
|
||||||
}
|
}
|
||||||
|
// 去除一下最右边的逗号
|
||||||
|
if len(ipAllocation) > 0 {
|
||||||
|
ipAllocation = strings.TrimRight(ipAllocation, ",")
|
||||||
|
}
|
||||||
connections = append(connections, vo.DataTraffic{
|
connections = append(connections, vo.DataTraffic{
|
||||||
Name: clientInfo.Name,
|
Name: clientInfo.Name,
|
||||||
Email: clientInfo.Email,
|
Email: clientInfo.Email,
|
||||||
|
@ -50,13 +50,13 @@ func Authorization() gin.HandlerFunc {
|
|||||||
// 查询用户
|
// 查询用户
|
||||||
user, err := service.User().GetUserById(userClaims.ID)
|
user, err := service.User().GetUserById(userClaims.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
response.R(c).FailedWithError("用户不存在")
|
response.R(c).AuthorizationFailed("用户不存在")
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.Status != constant.Enabled {
|
if user.Status != constant.Enabled {
|
||||||
response.R(c).FailedWithError("用户状态异常,请联系管理员处理!")
|
response.R(c).AuthorizationFailed("用户状态异常,请联系管理员处理!")
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user