From d6a31e5db8f6982cc7eb7ee01316b6fea6c499ba Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Thu, 16 Jun 2022 10:44:42 +0200 Subject: [PATCH] config verify password working --- cps/static/js/password.js | 61 ++++++++++++++++++---------------- cps/templates/config_edit.html | 7 ++-- cps/templates/user_edit.html | 2 +- cps/web.py | 2 ++ 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/cps/static/js/password.js b/cps/static/js/password.js index 7ab7e8f3..43a1a0ac 100644 --- a/cps/static/js/password.js +++ b/cps/static/js/password.js @@ -24,35 +24,40 @@ $(document).ready(function() { }, }, function () { - // Initialized and ready to go - var options = {}; - options.ui = { - bootstrap3: true, - showProgressBar: false, - showErrors: true, - showVerdicts: false, - } - options.rules= { - activated: { - wordNotEmail: false, - wordMinLength: true, - // wordMaxLength: false, - // wordInvalidChar: true, - wordSimilarToUsername: false, - wordSequences: false, - wordTwoCharacterClasses: false, - wordRepetitions: false, - //wordLowercase: true, - //wordUppercase: true, - wordOneNumber: true, - wordThreeNumbers: false, - wordOneSpecialChar: true, - // wordTwoSpecialChar: true, - wordUpperLowerCombo: false, - wordLetterNumberCombo: false, - wordLetterNumberCharCombo: false + if ($('#password').data("verify")) { + // Initialized and ready to go + var options = {}; + options.common = { + minChar: $('#password').data("min") } + options.ui = { + bootstrap3: true, + showProgressBar: false, + showErrors: true, + showVerdicts: false, + } + options.rules= { + activated: { + wordNotEmail: false, + wordMinLength: $('#password').data("min") ? true : false, + // wordMaxLength: false, + // wordInvalidChar: true, + wordSimilarToUsername: false, + wordSequences: false, + wordTwoCharacterClasses: false, + wordRepetitions: false, + wordLowercase: $('#password').data("lower") ? true : false, + wordUppercase: $('#password').data("upper") ? true : false, + wordOneNumber: $('#password').data("number") ? true : false, + wordThreeNumbers: false, + wordOneSpecialChar: $('#password').data("special") ? true : false, + // wordTwoSpecialChar: true, + wordUpperLowerCombo: false, + wordLetterNumberCombo: false, + wordLetterNumberCharCombo: false + } + } + $('#password').pwstrength(options); } - $('#password').pwstrength(options); }); }); diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html index fded8721..92e38217 100644 --- a/cps/templates/config_edit.html +++ b/cps/templates/config_edit.html @@ -352,6 +352,7 @@ {% endif %} +

@@ -370,9 +371,8 @@

-
- +
@@ -393,13 +393,14 @@
- +
+
diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index aea2156f..fd233d65 100755 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -21,7 +21,7 @@ {% endif %}
- +
{% endif %}
diff --git a/cps/web.py b/cps/web.py index dcccbc32..02ac75b1 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1382,6 +1382,7 @@ def change_profile(kobo_support, local_oauth_check, oauth_status, translations, flash(str(ex), category="error") return render_title_template("user_edit.html", content=current_user, + config=config, translations=translations, profile=1, languages=languages, @@ -1433,6 +1434,7 @@ def profile(): profile=1, languages=languages, content=current_user, + config=config, kobo_support=kobo_support, title=_(u"%(name)s's profile", name=current_user.name), page="me",