Auto reg user, event map

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-25 21:30:26 +08:00
parent c7cefb3898
commit b30d9db69d
10 changed files with 116 additions and 41 deletions

View File

@@ -1,7 +1,6 @@
package auth
import (
"net/http"
"nixcn-cms/internal/cryptography"
"github.com/gin-gonic/gin"
@@ -14,7 +13,7 @@ func Refresh(c *gin.Context) {
}
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
c.JSON(400, gin.H{"error": "invalid request"})
return
}
@@ -24,11 +23,11 @@ func Refresh(c *gin.Context) {
access, err := JwtTool.RefreshAccessToken(req.RefreshToken)
if err != nil {
c.JSON(http.StatusUnauthorized, gin.H{"error": "invalid refresh token"})
c.JSON(401, gin.H{"error": "invalid refresh token"})
return
}
c.JSON(http.StatusOK, gin.H{
c.JSON(200, gin.H{
"access_token": access,
})
}