mirror of
https://github.com/janeczku/calibre-web
synced 2025-10-12 14:17:40 +00:00
Improvements for password verify (addresses: https://github.com/iiab/calibre-web/pull/138)
This commit is contained in:
@@ -696,15 +696,15 @@ def valid_password(check_password):
|
||||
if config.config_password_min_length > 0:
|
||||
verify += r"^(?=.{" + str(config.config_password_min_length) + ",}$)"
|
||||
if config.config_password_number:
|
||||
verify += "(?=.*?\d)"
|
||||
verify += r"(?=.*?\d)"
|
||||
if config.config_password_lower:
|
||||
verify += "(?=.*?[\p{Ll}])"
|
||||
verify += r"(?=.*?[\p{Ll}])"
|
||||
if config.config_password_upper:
|
||||
verify += "(?=.*?[\p{Lu}])"
|
||||
verify += r"(?=.*?[\p{Lu}])"
|
||||
if config.config_password_character:
|
||||
verify += "(?=.*?[\p{Letter}])"
|
||||
verify += r"(?=.*?[\p{Letter}])"
|
||||
if config.config_password_special:
|
||||
verify += "(?=.*?[^\p{Letter}\s0-9])"
|
||||
verify += r"(?=.*?[^\p{Letter}\s0-9])"
|
||||
match = regex.match(verify, check_password)
|
||||
if not match:
|
||||
raise Exception(_("Password doesn't comply with password validation rules"))
|
||||
|
Reference in New Issue
Block a user