Don't ask user for privatekey if file can be signed with auth_privatekey
This commit is contained in:
parent
a89f66e8b5
commit
f4a040064c
2 changed files with 35 additions and 28 deletions
|
@ -354,17 +354,18 @@ class Sidebar extends Class
|
|||
@tag.find("#button-sign").off("click touchend").on "click touchend", =>
|
||||
inner_path = @tag.find("#input-contents").val()
|
||||
|
||||
if wrapper.site_info.privatekey
|
||||
# Privatekey stored in users.json
|
||||
wrapper.ws.cmd "siteSign", {privatekey: "stored", inner_path: inner_path, update_changed_files: true}, (res) =>
|
||||
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
||||
wrapper.ws.cmd "fileRules", {inner_path: inner_path}, (res) =>
|
||||
if wrapper.site_info.privatekey or wrapper.site_info.auth_address in res.signers
|
||||
# Privatekey stored in users.json
|
||||
wrapper.ws.cmd "siteSign", {privatekey: "stored", inner_path: inner_path, update_changed_files: true}, (res) =>
|
||||
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
||||
|
||||
else
|
||||
# Ask the user for privatekey
|
||||
wrapper.displayPrompt "Enter your private key:", "password", "Sign", "", (privatekey) => # Prompt the private key
|
||||
wrapper.ws.cmd "siteSign", {privatekey: privatekey, inner_path: inner_path, update_changed_files: true}, (res) =>
|
||||
if res == "ok"
|
||||
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
||||
else
|
||||
# Ask the user for privatekey
|
||||
wrapper.displayPrompt "Enter your private key:", "password", "Sign", "", (privatekey) => # Prompt the private key
|
||||
wrapper.ws.cmd "siteSign", {privatekey: privatekey, inner_path: inner_path, update_changed_files: true}, (res) =>
|
||||
if res == "ok"
|
||||
wrapper.notifications.add "sign", "done", "#{inner_path} Signed!", 5000
|
||||
|
||||
return false
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue