1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 17:40:31 +00:00

config verify password working

This commit is contained in:
Ozzieisaacs 2022-06-16 10:44:42 +02:00
parent 73d48e4ac1
commit d6a31e5db8
4 changed files with 40 additions and 32 deletions

View File

@ -24,35 +24,40 @@ $(document).ready(function() {
}, },
}, function () { }, function () {
// Initialized and ready to go if ($('#password').data("verify")) {
var options = {}; // Initialized and ready to go
options.ui = { var options = {};
bootstrap3: true, options.common = {
showProgressBar: false, minChar: $('#password').data("min")
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
} }
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);
}); });
}); });

View File

@ -352,6 +352,7 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
@ -370,9 +371,8 @@
<option value="1" {% if config.config_session == 1 %}selected{% endif %}>{{_('Strong')}}</option> <option value="1" {% if config.config_session == 1 %}selected{% endif %}>{{_('Strong')}}</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="checkbox" id="config_password_policy" data-control="password_settings" name="config_password_policy" {% if config.config_password %}checked{% endif %}> <input type="checkbox" id="config_password_policy" data-control="password_settings" name="config_password_policy" {% if config.config_password_policy %}checked{% endif %}>
<label for="config_password_policy">{{_('User Password policy')}}</label> <label for="config_password_policy">{{_('User Password policy')}}</label>
</div> </div>
<div data-related="password_settings"> <div data-related="password_settings">
@ -393,13 +393,14 @@
<label for="config_password_upper">{{_('Enforce uppercase characters')}}</label> <label for="config_password_upper">{{_('Enforce uppercase characters')}}</label>
</div> </div>
<div class="form-group" style="margin-left:10px;"> <div class="form-group" style="margin-left:10px;">
<input type="checkbox" id="config_password_special" name="config_password_special" {% if config.config_kobo_proxy %}checked{% endif %}> <input type="checkbox" id="config_password_special" name="config_password_special" {% if config.config_password_special %}checked{% endif %}>
<label for="config_password_special">{{_('Enforce special characters')}}</label> <label for="config_password_special">{{_('Enforce special characters')}}</label>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12">
<button type="button" name="submit" id="config_submit" class="btn btn-default">{{_('Save')}}</button> <button type="button" name="submit" id="config_submit" class="btn btn-default">{{_('Save')}}</button>

View File

@ -21,7 +21,7 @@
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
<label for="password">{{_('Password')}}</label> <label for="password">{{_('Password')}}</label>
<input type="password" class="form-control" name="password" id="password" data-lang="{{ g.user.locale }}" value="" autocomplete="off"> <input type="password" class="form-control" name="password" id="password" data-lang="{{ g.user.locale }}" data-verify="{{ config.config_password_policy }}" {% if config.config_password_policy %} data-min={{ config.config_password_min_length }} data-special={{ config.config_password_special }} data-upper={{ config.config_password_upper }} data-lower={{ config.config_password_lower }} data-number={{ config.config_password_number }}{% endif %} value="" autocomplete="off">
</div> </div>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">

View File

@ -1382,6 +1382,7 @@ def change_profile(kobo_support, local_oauth_check, oauth_status, translations,
flash(str(ex), category="error") flash(str(ex), category="error")
return render_title_template("user_edit.html", return render_title_template("user_edit.html",
content=current_user, content=current_user,
config=config,
translations=translations, translations=translations,
profile=1, profile=1,
languages=languages, languages=languages,
@ -1433,6 +1434,7 @@ def profile():
profile=1, profile=1,
languages=languages, languages=languages,
content=current_user, content=current_user,
config=config,
kobo_support=kobo_support, kobo_support=kobo_support,
title=_(u"%(name)s's profile", name=current_user.name), title=_(u"%(name)s's profile", name=current_user.name),
page="me", page="me",