Add confirmation question to new accounts/delete switch
This commit is contained in:
parent
ead69148b7
commit
3bd34087ce
2 changed files with 14 additions and 6 deletions
|
|
@ -737,12 +737,11 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
|
||||||
confirm += ", ".join(["#{}".format(obj.id) for obj in objs])
|
confirm += ", ".join(["#{}".format(obj.id) for obj in objs])
|
||||||
confirm += " [yes]/no?" if self.default_confirm == 'yes' else " yes/[no]"
|
confirm += " [yes]/no?" if self.default_confirm == 'yes' else " yes/[no]"
|
||||||
answer = ""
|
answer = ""
|
||||||
while answer.strip().lower() not in ("y", "yes", "n", "no"):
|
|
||||||
answer = yield(confirm)
|
answer = yield(confirm)
|
||||||
answer = self.default_confirm if answer == '' else answer
|
answer = self.default_confirm if answer == '' else answer
|
||||||
|
|
||||||
if answer.strip().lower() in ("n", "no"):
|
if answer.strip().lower() in ("n", "no"):
|
||||||
caller.msg("Cancelled: no object was destroyed.")
|
caller.msg("Canceled: no object was destroyed.")
|
||||||
delete = False
|
delete = False
|
||||||
|
|
||||||
if delete:
|
if delete:
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,7 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
|
||||||
If not given, <nr> defaults to 10.
|
If not given, <nr> defaults to 10.
|
||||||
"""
|
"""
|
||||||
key = "@accounts"
|
key = "@accounts"
|
||||||
aliases = ["@listaccounts"]
|
aliases = ["@account", "@listaccounts"]
|
||||||
switch_options = ("delete", )
|
switch_options = ("delete", )
|
||||||
locks = "cmd:perm(listaccounts) or perm(Admin)"
|
locks = "cmd:perm(listaccounts) or perm(Admin)"
|
||||||
help_category = "System"
|
help_category = "System"
|
||||||
|
|
@ -512,6 +512,15 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
|
||||||
self.msg("You don't have the permissions to delete that account.")
|
self.msg("You don't have the permissions to delete that account.")
|
||||||
return
|
return
|
||||||
username = account.username
|
username = account.username
|
||||||
|
# ask for confirmation
|
||||||
|
confirm = ("It is often better to block access to an account rather than to delete it. "
|
||||||
|
"|yAre you sure you want to permanently delete "
|
||||||
|
"account '|n{}|y'|n yes/[no]?".format(username))
|
||||||
|
answer = yield(confirm)
|
||||||
|
if answer.lower() not in ('y', 'yes'):
|
||||||
|
caller.msg("Canceled deletion.")
|
||||||
|
return
|
||||||
|
|
||||||
# Boot the account then delete it.
|
# Boot the account then delete it.
|
||||||
self.msg("Informing and disconnecting account ...")
|
self.msg("Informing and disconnecting account ...")
|
||||||
string = "\nYour account '%s' is being *permanently* deleted.\n" % username
|
string = "\nYour account '%s' is being *permanently* deleted.\n" % username
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue