From f3360d12491791745d89a943d7fb1ecd06de933f Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Sat, 5 Feb 2022 02:06:02 -0800 Subject: [PATCH] fix: eradicate spaces from pgp key fingerprint input Signed-off-by: Kevin Morris --- aurweb/routers/accounts.py | 6 +++++- aurweb/util.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/aurweb/routers/accounts.py b/aurweb/routers/accounts.py index d296a9b9..7cd25c49 100644 --- a/aurweb/routers/accounts.py +++ b/aurweb/routers/accounts.py @@ -265,7 +265,7 @@ async def account_register_post(request: Request, "options", "default_lang")), TZ: str = Form(default=aurweb.config.get( "options", "default_timezone")), - PK: str = Form(default=None), # SSH PubKey + PK: str = Form(default=str()), # SSH PubKey CN: bool = Form(default=False), UN: bool = Form(default=False), ON: bool = Form(default=False), @@ -273,6 +273,8 @@ async def account_register_post(request: Request, captcha_salt: str = Form(...)): context = await make_variable_context(request, "Register") args = dict(await request.form()) + args["K"] = args.get("K", str()).replace(" ", "") + K = args.get("K") context = make_account_form_context(context, request, None, args) ok, errors = process_account_form(request, request.user, args) @@ -399,6 +401,8 @@ async def account_edit_post(request: Request, context["user"] = db.refresh(user) args = dict(await request.form()) + args["K"] = args.get("K", str()).replace(" ", "") + context = make_account_form_context(context, request, user, args) ok, errors = process_account_form(request, user, args) diff --git a/aurweb/util.py b/aurweb/util.py index cb8e4b5b..7ed4d1d3 100644 --- a/aurweb/util.py +++ b/aurweb/util.py @@ -71,7 +71,6 @@ def valid_password(password): def valid_pgp_fingerprint(fp): - fp = fp.replace(" ", "") try: # Attempt to convert the fingerprint to an int via base16. # If it can't, it's not a hex string.