fix add key
This commit is contained in:
parent
f59eca6724
commit
8ed0f12fb4
@ -29,9 +29,6 @@ func wsStoreAddKey(req *restful.Request, resp *restful.Response) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
secStore.AddKey(np.Name, np.Passphrase)
|
|
||||||
defer updateState()
|
|
||||||
|
|
||||||
for _, k := range secStore.Keys {
|
for _, k := range secStore.Keys {
|
||||||
if k.Name == np.Name {
|
if k.Name == np.Name {
|
||||||
wsBadRequest(resp, "there's already a passphrase named "+strconv.Quote(np.Name))
|
wsBadRequest(resp, "there's already a passphrase named "+strconv.Quote(np.Name))
|
||||||
@ -39,6 +36,9 @@ func wsStoreAddKey(req *restful.Request, resp *restful.Response) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
secStore.AddKey(np.Name, np.Passphrase)
|
||||||
|
defer updateState()
|
||||||
|
|
||||||
err = secStore.SaveTo(secKeysStorePath())
|
err = secStore.SaveTo(secKeysStorePath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wsError(resp, err)
|
wsError(resp, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user