mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Ask for confirm in default account creation. Resolves #1523
This commit is contained in:
parent
1a581162bc
commit
e4013dbdb8
4 changed files with 17 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ Up requirements to Django 3.2+, Twisted 21+
|
|||
column instead of inserting rows based on cell-size (could be mistaken for a bug).
|
||||
- Split `return_appearance` hook with helper methods and have it use a template
|
||||
string in order to make it easier to override.
|
||||
- Add validation question to default account creation.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,20 @@ class CmdUnconnectedCreate(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
username, password = parts
|
||||
|
||||
# pre-normalize username so the user know what they get
|
||||
non_normalized_username = username
|
||||
username = Account.normalize_username(username)
|
||||
if non_normalized_username != username:
|
||||
session.msg("Note: your username was normalized to strip spaces and remove characters "
|
||||
"that could be visually confusing.")
|
||||
|
||||
# have the user verify their new account was what they intended
|
||||
answer = yield(f"You want to create an account '{username}' with password '{password}'."
|
||||
"\nIs this what you intended? [Y]/N?")
|
||||
if answer.lower() in ('n', 'no'):
|
||||
session.msg("Aborted. If your user name contains spaces, surround it by quotes.")
|
||||
return
|
||||
|
||||
# everything's ok. Create the new account account.
|
||||
account, errors = Account.create(
|
||||
username=username, password=password, ip=address, session=session
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ def c_login(client):
|
|||
# teleport it (to keep the login room clean)
|
||||
cmds = (
|
||||
f"create {cname} {cpwd}",
|
||||
f"yes", # to confirm creation
|
||||
f"connect {cname} {cpwd}",
|
||||
f"dig {room_name}",
|
||||
f"teleport {room_name}",
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class TestDummyrunnerSettings(TestCase):
|
|||
c_login(self.client),
|
||||
(
|
||||
Something, # create
|
||||
'yes', # confirm creation
|
||||
Something, # connect
|
||||
"dig %s" % self.client.start_room,
|
||||
"teleport %s" % self.client.start_room,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue