Fix account registration bug

main
Bob Mottram 2023-03-19 17:09:25 +00:00
parent 28943c3ef7
commit bc8b505616
2 changed files with 9 additions and 6 deletions

View File

@ -2328,7 +2328,8 @@ class PubServer(BaseHTTPRequestHandler):
base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
ua_str: str, debug: bool) -> None:
ua_str: str, debug: bool,
registrations_open: bool) -> None:
"""POST to login screen, containing credentials
"""
# ensure that there is a minimum delay between failed login
@ -2368,7 +2369,8 @@ class PubServer(BaseHTTPRequestHandler):
login_nickname, login_password, register = \
html_get_login_credentials(login_params,
self.server.last_login_time,
domain)
domain,
registrations_open)
if login_nickname and login_password:
if is_system_account(login_nickname):
print('Invalid username login: ' + login_nickname +
@ -22429,7 +22431,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
ua_str, self.server.debug)
ua_str, self.server.debug,
self.server.registration)
self.server.postreq_busy = False
return

View File

@ -24,8 +24,8 @@ from theme import get_text_mode_logo
def html_get_login_credentials(login_params: str,
last_login_time: int,
domain: str) -> (str, str, bool):
last_login_time: int, domain: str,
registrations_open: bool) -> (str, str, bool):
"""Receives login credentials via HTTPServer POST
"""
if not login_params.startswith('username='):
@ -53,7 +53,7 @@ def html_get_login_credentials(login_params: str,
nickname = nickname.split('@')[0]
elif arg.split('=', 1)[0] == 'password':
password = arg.split('=', 1)[1]
elif arg.split('=', 1)[0] == 'register':
elif registrations_open and arg.split('=', 1)[0] == 'register':
register = True
return nickname, password, register