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
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -21,9 +21,9 @@
|
||||
title: "Clef PGP",
|
||||
});
|
||||
}, (error) => {
|
||||
submitInProgress = false;
|
||||
holdSubmit = false;
|
||||
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,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -85,7 +85,7 @@
|
||||
class="form-control"
|
||||
rows="10"
|
||||
bind:value={mykey}
|
||||
placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
QmllbiBzw7tyIHF1ZSBjJ2VzdCB1bmUgY2hhw65uZSBxdWkgdmV1dCBkaXJlIHF1
|
||||
ZWxxdWUgY2hvc2UK ...
|
||||
@ -94,6 +94,7 @@ ZWxxdWUgY2hvc2UK ...
|
||||
<button
|
||||
type="submit"
|
||||
class="mt-2 btn btn-primary"
|
||||
disable={!holdSubmit}
|
||||
>
|
||||
Enregistrer cette clef PGP
|
||||
</button>
|
||||
|
Reference in New Issue
Block a user