keys: Add checks
This commit is contained in:
parent
767da66f63
commit
ba98b9ed69
5
keys.go
5
keys.go
@ -51,6 +51,11 @@ func declareAPIAuthKeysRoutes(router *gin.RouterGroup) {
|
|||||||
return
|
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)
|
k, err := u.NewKey(key.Type, key.Content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Unable to NewKey:", err)
|
log.Println("Unable to NewKey:", err)
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
title: "Clef PGP",
|
title: "Clef PGP",
|
||||||
});
|
});
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
submitInProgress = false;
|
holdSubmit = false;
|
||||||
ToastsStore.addErrorToast({
|
ToastsStore.addErrorToast({
|
||||||
msg: "Une erreur s'est produite durant l'envoi de votre clef : " + error + "\nVeuillez réessayer dans quelques instants.",
|
msg: "Une erreur s'est produite durant l'envoi de votre clef : " + error,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -94,6 +94,7 @@ ZWxxdWUgY2hvc2UK ...
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="mt-2 btn btn-primary"
|
class="mt-2 btn btn-primary"
|
||||||
|
disable={!holdSubmit}
|
||||||
>
|
>
|
||||||
Enregistrer cette clef PGP
|
Enregistrer cette clef PGP
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user