Skip to content

Fix feedback returned when get_match_feedback doesn't find a match#13

Open
zeezooz wants to merge 1 commit into
careapp-group:masterfrom
zeezooz:fix_feedback
Open

Fix feedback returned when get_match_feedback doesn't find a match#13
zeezooz wants to merge 1 commit into
careapp-group:masterfrom
zeezooz:fix_feedback

Conversation

@zeezooz

@zeezooz zeezooz commented May 27, 2023

Copy link
Copy Markdown

Also fix suggestions for the regex case.

Now it works like the original.

…ix suggestions for the regex case

Now it works like the original.
@ltOgt

ltOgt commented Oct 23, 2024

Copy link
Copy Markdown

Without this the default feedback keeps getting modified:

static Feedback default_feedback = Feedback() // <---------- NOTE: NOT FINAL
    ..warning = ''
    ..suggestions = [
      "Use a few words, avoid common phrases"
          "No need for symbols, digits, or uppercase letters"
    ];
static Feedback get_match_feedback(PasswordMatch match, bool is_sole_match) {
     // other cases ...
     // default case:
    return default_feedback;
final extra_feedback = 'Add another word or two. Uncommon words are better.';
    if (feedback != null) {
      feedback.suggestions!.insert(0, extra_feedback);  // <--------- keeps adding this with every run
      if (feedback.warning == null) {
        feedback.warning = '';
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants