This commit is contained in:
@@ -70,13 +70,14 @@ func StoreSecret(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO - replace this with a call to SecretsGetMultipleSafes
|
||||
|
||||
// If this secret already exists in the database then generate an error
|
||||
checkExists, err := models.GetSecrets(&s, false)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
if len(checkExists) > 0 {
|
||||
log.Printf("StoreSecret not storing secret with '%d' already matching secrets.\n", len(checkExists))
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "StoreSecret attempting to store secret already defined. Use update API call instead"})
|
||||
@@ -156,6 +157,8 @@ func UpdateSecret(c *gin.Context) {
|
||||
|
||||
s.SafeId = safeId
|
||||
|
||||
// TODO - replace this with a call to SecretsGetMultipleSafes
|
||||
|
||||
// Confirm that the secret already exists
|
||||
checkExists, err := models.GetSecrets(&s, false)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user