gemini: make it clear that empty CN is OK

Will it be OK for all servers though? We might never know…
This commit is contained in:
dece 2021-06-18 01:44:17 +02:00
parent 36d0e6f7b1
commit 04c66bad52
2 changed files with 12 additions and 4 deletions

View file

@ -388,11 +388,18 @@ class Browser:
elif command == "set-render-mode": elif command == "set-render-mode":
self.set_render_mode(words[1]) self.set_render_mode(words[1])
def get_user_text_input(self, status_text, char, prefix="", strip=False): def get_user_text_input(self, status_text, char, prefix="", strip=False,
escape_to_none=False):
"""Get user input from the command-line.""" """Get user input from the command-line."""
self.set_status(status_text) self.set_status(status_text)
result = self.command_line.focus(char, prefix=prefix) result = self.command_line.focus(
char,
prefix=prefix,
escape_to_none=escape_to_none
)
self.reset_status() self.reset_status()
if result is None:
return None
if strip: if strip:
result = result.strip() result = result.strip()
return result return result

View file

@ -332,11 +332,12 @@ def create_identity(browser: Browser, url: str, reason: Optional[str] =None):
return None return None
common_name = browser.get_user_text_input( common_name = browser.get_user_text_input(
"Name? The server will see this, you can leave it empty.", "Name? The server may use it as your username.",
CommandLine.CHAR_TEXT, CommandLine.CHAR_TEXT,
strip=True, strip=True,
escape_to_none=True
) )
if not common_name: if common_name is None:
browser.reset_status() browser.reset_status()
return None return None