diff --git a/CHANGELOG.md b/CHANGELOG.md index f60fe2a392..c20eb78902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/evennia/commands/default/unloggedin.py b/evennia/commands/default/unloggedin.py index 2cceeca4fb..533e0677b6 100644 --- a/evennia/commands/default/unloggedin.py +++ b/evennia/commands/default/unloggedin.py @@ -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 diff --git a/evennia/server/profiling/dummyrunner_settings.py b/evennia/server/profiling/dummyrunner_settings.py index 924c7453f7..b4bb7090bb 100644 --- a/evennia/server/profiling/dummyrunner_settings.py +++ b/evennia/server/profiling/dummyrunner_settings.py @@ -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}", diff --git a/evennia/server/profiling/tests.py b/evennia/server/profiling/tests.py index d887a669c6..8e6cfd7ed7 100644 --- a/evennia/server/profiling/tests.py +++ b/evennia/server/profiling/tests.py @@ -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,