From 785b0cdb71af58990eda1d412f467d59823db502 Mon Sep 17 00:00:00 2001 From: Sietse Snel Date: Wed, 18 Oct 2023 16:38:09 +0200 Subject: [PATCH] YDA-5505: do not accept backslashes in passwords These don't get passed correctly to the external-auth script on the provider, and therefore cause authentication to fail. --- yoda_eus/password_complexity.py | 3 +++ yoda_eus/templates/web/activate.html | 4 ++++ yoda_eus/templates/web/password-requirements.html | 2 +- yoda_eus/templates/web/reset-password.html | 4 ++++ yoda_eus/tests/test_unit.py | 4 ++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/yoda_eus/password_complexity.py b/yoda_eus/password_complexity.py index db15905..2ab51b6 100644 --- a/yoda_eus/password_complexity.py +++ b/yoda_eus/password_complexity.py @@ -33,4 +33,7 @@ def check_password_complexity(password: str) -> List[str]: if not (any(c in string.punctuation for c in password)): errors.append("Password needs to contain at least one punctuation character ({})".format(string.punctuation)) + if "\\" in password: + errors.append("Password must not contain backslashes.") + return errors diff --git a/yoda_eus/templates/web/activate.html b/yoda_eus/templates/web/activate.html index d683cb2..e096ee6 100644 --- a/yoda_eus/templates/web/activate.html +++ b/yoda_eus/templates/web/activate.html @@ -119,6 +119,10 @@ passwordErrors.innerHTML = 'The passwords do not match.'; submitButton.disabled = true; } + else if ( password.includes('\\') { + passwordErrors.innerHTML = 'The password contains a backslash.'; + submitButton.disabled = true; + } else { passwordErrors.innerHTML = ''; submitButton.disabled = false; diff --git a/yoda_eus/templates/web/password-requirements.html b/yoda_eus/templates/web/password-requirements.html index aee37c9..96fdfb6 100644 --- a/yoda_eus/templates/web/password-requirements.html +++ b/yoda_eus/templates/web/password-requirements.html @@ -1,7 +1,7 @@

Your password must meet the following requirements: