This commit is contained in:
2023-04-03 11:04:52 +10:00
parent 8432286101
commit c229e93103
6 changed files with 86 additions and 2 deletions

View File

@@ -42,6 +42,11 @@ func StoreSecret(c *gin.Context) {
s.RoleId = 1
}
if input.DeviceCategory == "" && input.DeviceName == "" {
c.JSON(http.StatusBadRequest, gin.H{"error": "cannot store secret with empty deviceName and empty deviceCategory"})
return
}
// If this secret already exists in the database then generate an error
checkExists, err := models.GetSecrets(&s)
if err != nil {