From 3bd34087ce8f7479486fb2c7344d9fbd61166e61 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 13 Oct 2018 11:26:31 +0200 Subject: [PATCH] Add confirmation question to new accounts/delete switch --- evennia/commands/default/building.py | 7 +++---- evennia/commands/default/system.py | 13 +++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index f0ae108f00..19ab0f7508 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -737,12 +737,11 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS): confirm += ", ".join(["#{}".format(obj.id) for obj in objs]) confirm += " [yes]/no?" if self.default_confirm == 'yes' else " yes/[no]" answer = "" - while answer.strip().lower() not in ("y", "yes", "n", "no"): - answer = yield(confirm) - answer = self.default_confirm if answer == '' else answer + answer = yield(confirm) + answer = self.default_confirm if answer == '' else answer if answer.strip().lower() in ("n", "no"): - caller.msg("Cancelled: no object was destroyed.") + caller.msg("Canceled: no object was destroyed.") delete = False if delete: diff --git a/evennia/commands/default/system.py b/evennia/commands/default/system.py index 070420f4c3..3a14a296b4 100644 --- a/evennia/commands/default/system.py +++ b/evennia/commands/default/system.py @@ -474,8 +474,8 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS): If not given, defaults to 10. """ key = "@accounts" - aliases = ["@listaccounts"] - switch_options = ("delete",) + aliases = ["@account", "@listaccounts"] + switch_options = ("delete", ) locks = "cmd:perm(listaccounts) or perm(Admin)" help_category = "System" @@ -512,6 +512,15 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS): self.msg("You don't have the permissions to delete that account.") return 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. self.msg("Informing and disconnecting account ...") string = "\nYour account '%s' is being *permanently* deleted.\n" % username