1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Added a no_passphrase flag to hide the passphrase input field from the web interface.

This commit is contained in:
Sascha L. Teichmann 2021-11-16 14:43:35 +01:00
parent 7cf1580d5f
commit ef0a92b491
3 changed files with 4 additions and 1 deletions

View file

@ -23,6 +23,7 @@ type config struct {
UploadSignature bool `toml:"upload_signature"` UploadSignature bool `toml:"upload_signature"`
PGPURL string `toml:"pgp_url"` PGPURL string `toml:"pgp_url"`
Domain string `toml:"domain"` Domain string `toml:"domain"`
NoPassphrase bool `toml:"no_passphrase"`
} }
type tlp string type tlp string

View file

@ -179,7 +179,7 @@ func (c *controller) handleSignature(r *http.Request, data []byte) (string, stri
// Sign ourself // Sign ourself
if passwd := r.FormValue("passphrase"); passwd != "" { if passwd := r.FormValue("passphrase"); !c.cfg.NoPassphrase && passwd != "" {
if key, err = key.Unlock([]byte(passwd)); err != nil { if key, err = key.Unlock([]byte(passwd)); err != nil {
return "", "", err return "", "", err
} }

View file

@ -30,9 +30,11 @@
<textarea name="signature" id="signature" required="required" cols="65" rows="20" <textarea name="signature" id="signature" required="required" cols="65" rows="20"
placeholder="Insert ASCII armored signature here ..."></textarea> placeholder="Insert ASCII armored signature here ..."></textarea>
{{ else }} {{ else }}
{{ if not .Config.NoPassphrase }}
<label for="passphrase">Key passphrase:</label> <label for="passphrase">Key passphrase:</label>
<input name="passphrase" type="password" id="passphrase"> <input name="passphrase" type="password" id="passphrase">
{{ end }} {{ end }}
{{ end }}
<br> <br>
<input type="submit" value="Upload"> <input type="submit" value="Upload">
</fieldset> </fieldset>