mirror of
https://github.com/janeczku/calibre-web
synced 2024-10-31 23:26:20 +00:00
Improvements for password verify (addresses: https://github.com/iiab/calibre-web/pull/138)
This commit is contained in:
parent
14b578dd3a
commit
fcc95bd895
@ -696,15 +696,15 @@ def valid_password(check_password):
|
|||||||
if config.config_password_min_length > 0:
|
if config.config_password_min_length > 0:
|
||||||
verify += r"^(?=.{" + str(config.config_password_min_length) + ",}$)"
|
verify += r"^(?=.{" + str(config.config_password_min_length) + ",}$)"
|
||||||
if config.config_password_number:
|
if config.config_password_number:
|
||||||
verify += "(?=.*?\d)"
|
verify += r"(?=.*?\d)"
|
||||||
if config.config_password_lower:
|
if config.config_password_lower:
|
||||||
verify += "(?=.*?[\p{Ll}])"
|
verify += r"(?=.*?[\p{Ll}])"
|
||||||
if config.config_password_upper:
|
if config.config_password_upper:
|
||||||
verify += "(?=.*?[\p{Lu}])"
|
verify += r"(?=.*?[\p{Lu}])"
|
||||||
if config.config_password_character:
|
if config.config_password_character:
|
||||||
verify += "(?=.*?[\p{Letter}])"
|
verify += r"(?=.*?[\p{Letter}])"
|
||||||
if config.config_password_special:
|
if config.config_password_special:
|
||||||
verify += "(?=.*?[^\p{Letter}\s0-9])"
|
verify += r"(?=.*?[^\p{Letter}\s0-9])"
|
||||||
match = regex.match(verify, check_password)
|
match = regex.match(verify, check_password)
|
||||||
if not match:
|
if not match:
|
||||||
raise Exception(_("Password doesn't comply with password validation rules"))
|
raise Exception(_("Password doesn't comply with password validation rules"))
|
||||||
|
@ -24,7 +24,7 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
if ($('#password').data("verify")) {
|
if ($('#password').data("verify") === "True") {
|
||||||
// Initialized and ready to go
|
// Initialized and ready to go
|
||||||
var options = {};
|
var options = {};
|
||||||
options.common = {
|
options.common = {
|
||||||
|
Loading…
Reference in New Issue
Block a user