mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-22 22:00:08 +00:00
fix: disallow API key renewal and creation with API key authentication (#1334)
This commit is contained in:
@@ -77,6 +77,9 @@ func (s *ApiKeyService) CreateApiKey(ctx context.Context, userID string, input d
|
||||
Create(&apiKey).
|
||||
Error
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrDuplicatedKey) {
|
||||
return model.ApiKey{}, "", &common.AlreadyInUseError{Property: "API key name"}
|
||||
}
|
||||
return model.ApiKey{}, "", err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user