fix: complete audit security and frontend gaps
This commit is contained in:
@@ -26,3 +26,12 @@ func RequireUser(tokenVerifier func(string) (uint, error)) gin.HandlerFunc {
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func CurrentUserID(c *gin.Context) (uint, bool) {
|
||||
value, ok := c.Get(CurrentUserIDKey)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
userID, ok := value.(uint)
|
||||
return userID, ok && userID > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user