admin: allow certid to finish by .p12, to permit downloading .p12 file
This commit is contained in:
parent
703eaef880
commit
b778d29dd9
|
@ -8,6 +8,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"srs.epita.fr/fic-server/libfic"
|
"srs.epita.fr/fic-server/libfic"
|
||||||
|
@ -317,7 +318,7 @@ func fileHandler(f func(fic.EFile, []byte) (interface{}, error)) func(httprouter
|
||||||
|
|
||||||
func certificateHandler(f func(fic.Certificate, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
|
func certificateHandler(f func(fic.Certificate, []byte) (interface{}, error)) func(httprouter.Params, []byte) (interface{}, error) {
|
||||||
return func(ps httprouter.Params, body []byte) (interface{}, error) {
|
return func(ps httprouter.Params, body []byte) (interface{}, error) {
|
||||||
if certid, err := strconv.ParseUint(string(ps.ByName("certid")), 10, 64); err != nil {
|
if certid, err := strconv.ParseUint(strings.TrimSuffix(string(ps.ByName("certid")), ".p12"), 10, 64); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if cert, err := fic.GetCertificate(certid); err != nil {
|
} else if cert, err := fic.GetCertificate(certid); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ certificate.revoked }}</td>
|
<td>{{ certificate.revoked }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a type="button" class="btn btn-sm btn-success" href="api/certs/{{ certificate.id }}" target="_self">Télécharger</a>
|
<a type="button" class="btn btn-sm btn-success" href="api/certs/{{ certificate.id }}.p12" target="_self">Télécharger</a>
|
||||||
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#revokeModal" data-certificate="{{ certificate.id }}" ng-class="{disabled: certificate.revoked}">Révoquer</button>
|
<button type="button" class="btn btn-sm btn-danger" data-toggle="modal" data-target="#revokeModal" data-certificate="{{ certificate.id }}" ng-class="{disabled: certificate.revoked}">Révoquer</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
Date de création
|
Date de création
|
||||||
<a class="btn btn-sm btn-success float-right" href="api/certs/{{ cert.id }}">Télécharger</a>
|
<a class="btn btn-sm btn-success float-right" href="api/certs/{{ cert.id }}.p12" target="_self">Télécharger</a>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>{{ cert.creation }}</dd>
|
<dd>{{ cert.creation }}</dd>
|
||||||
<dt>Mot de passe</dt>
|
<dt>Mot de passe</dt>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user