check whether api token is enabled when using an api token

This commit is contained in:
MaysWind
2025-11-03 22:52:15 +08:00
parent b0e01d36ab
commit 03c342f6f6
26 changed files with 162 additions and 143 deletions
+2 -2
View File
@@ -422,8 +422,8 @@ func (l *UserDataCli) CreateNewUserToken(c *core.CliContext, username string, to
var tokenRecord *models.TokenRecord
if tokenType == "api" {
if !l.CurrentConfig().EnableGenerateAPIToken {
return nil, "", errs.ErrNotAllowedToGenerateAPIToken
if !l.CurrentConfig().EnableAPIToken {
return nil, "", errs.ErrAPITokenNotEnabled
}
if user.FeatureRestriction.Contains(core.USER_FEATURE_RESTRICTION_TYPE_GENERATE_API_TOKEN) {