Update: Successful authentication records the identifier.

This commit is contained in:
EUForest
2025-11-06 15:32:29 +08:00
parent 52ce054b35
commit de6661cc16
8 changed files with 28 additions and 21 deletions
+2 -2
View File
@@ -42,11 +42,11 @@ func DeviceMiddleware(srvCtx *svc.ServiceContext) func(c *gin.Context) {
ctx := c.Request.Context()
if ctx.Value(constant.CtxKeyUser) == nil && c.GetHeader("Login-Type") != "" {
ctx = context.WithValue(ctx, constant.LoginType, c.GetHeader("Login-Type"))
ctx = context.WithValue(ctx, constant.CtxLoginType, c.GetHeader("Login-Type"))
c.Request = c.Request.WithContext(ctx)
}
loginType, ok := ctx.Value(constant.LoginType).(string)
loginType, ok := ctx.Value(constant.CtxLoginType).(string)
if !ok || loginType != "device" {
c.Next()
return