keys: Add checks
This commit is contained in:
parent
767da66f63
commit
ba98b9ed69
2 changed files with 9 additions and 3 deletions
5
keys.go
5
keys.go
|
|
@ -51,6 +51,11 @@ func declareAPIAuthKeysRoutes(router *gin.RouterGroup) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := key.CheckKey(); err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
k, err := u.NewKey(key.Type, key.Content)
|
||||
if err != nil {
|
||||
log.Println("Unable to NewKey:", err)
|
||||
|
|
|
|||
Reference in a new issue