feat: 新增设备登录功能,包括API接口、RPC服务、逻辑处理和相关数据类型及错误码。
Build docker and publish / prepare (20.15.1) (push) Successful in 11s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Successful in 4m32s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Successful in 8m6s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Successful in 4m26s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.rpc-core image_name:ppanel-rpc-core name:rpc-core]) (push) Successful in 8m23s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Successful in 4m1s
Build docker and publish / deploy (push) Successful in 45s
Build docker and publish / notify (push) Successful in 3s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Successful in 3m55s
Build docker and publish / prepare (20.15.1) (push) Successful in 11s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Successful in 4m32s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Successful in 8m6s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Successful in 4m26s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.rpc-core image_name:ppanel-rpc-core name:rpc-core]) (push) Successful in 8m23s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Successful in 4m1s
Build docker and publish / deploy (push) Successful in 45s
Build docker and publish / notify (push) Successful in 3s
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Successful in 3m55s
This commit is contained in:
+4
-3
@@ -13,10 +13,11 @@ type Claims struct {
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
func GenerateToken(secret string, userId int64, isAdmin bool, expire int64) (string, error) {
|
||||
func GenerateToken(secret string, userId int64, loginType string, isAdmin bool, expire int64) (string, error) {
|
||||
claims := Claims{
|
||||
UserId: userId,
|
||||
IsAdmin: isAdmin,
|
||||
UserId: userId,
|
||||
LoginType: loginType,
|
||||
IsAdmin: isAdmin,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Duration(expire) * time.Second)),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
|
||||
@@ -24,4 +24,6 @@ const (
|
||||
SignatureInvalid = 7003
|
||||
SignatureReplay = 7004
|
||||
DecryptFailed = 7005
|
||||
DeviceLoginDisabled = 8001
|
||||
DeviceNotEnabled = 8002
|
||||
)
|
||||
|
||||
@@ -24,6 +24,8 @@ var codeText = map[int]string{
|
||||
SignatureInvalid: "签名错误",
|
||||
SignatureReplay: "重放攻击",
|
||||
DecryptFailed: "解密失败",
|
||||
DeviceLoginDisabled: "设备登录未启用",
|
||||
DeviceNotEnabled: "设备已禁用",
|
||||
}
|
||||
|
||||
func IsCodeErr(errcode uint32) bool {
|
||||
|
||||
Reference in New Issue
Block a user