소스 검색

[fix] password strength (via error snapshot)

version-14
Rushabh Mehta 8 년 전
부모
커밋
db25d89d00
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. +5
    -2
      frappe/utils/password_strength.py

+ 5
- 2
frappe/utils/password_strength.py 파일 보기

@@ -23,7 +23,7 @@ import re
from zxcvbn import scoring from zxcvbn import scoring


# Default feedback value # Default feedback value
feedback = {
default_feedback = {
"warning": "", "warning": "",
"suggestions":[ "suggestions":[
_("Use a few words, avoid common phrases."), _("Use a few words, avoid common phrases."),
@@ -35,9 +35,10 @@ def get_feedback (score, sequence):
""" """
Returns the feedback dictionary consisting of ("warning","suggestions") for the given sequences. Returns the feedback dictionary consisting of ("warning","suggestions") for the given sequences.
""" """
global default_feedback
# Starting feedback # Starting feedback
if len(sequence) == 0: if len(sequence) == 0:
return feedback
return default_feedback
# No feedback if score is good or great # No feedback if score is good or great
if score > 2: if score > 2:
return dict({"warning": "","suggestions": []}) return dict({"warning": "","suggestions": []})
@@ -119,6 +120,7 @@ def get_match_feedback(match, is_sole_match):
_("Avoid dates and years that are associated with you.") _("Avoid dates and years that are associated with you.")
], ],
} }

# Dictionary that maps pattern names to funtions that return feedback # Dictionary that maps pattern names to funtions that return feedback
patterns = { patterns = {
"bruteforce": fun_bruteforce, "bruteforce": fun_bruteforce,
@@ -128,6 +130,7 @@ def get_match_feedback(match, is_sole_match):
"sequence": fun_sequence, "sequence": fun_sequence,
"regex": fun_regex, "regex": fun_regex,
"date": fun_date, "date": fun_date,
"year": fun_date
} }
return(patterns[match['pattern']]()) return(patterns[match['pattern']]())




불러오는 중...
취소
저장