Sha256: 9439bc6aff65bf7f24b3ac553b91c0f64d3ad3ed5412cae34262009386bbea1c

Contents?: true

Size: 469 Bytes

Versions: 2

Compression:

Stored size: 469 Bytes

Contents

import { Controller } from "stimulus";
import zxcvbn from "zxcvbn";

export default class extends Controller {
  static targets = ["strengthIndicator"];

  estimateStrength(e) {
    const result = zxcvbn(e.target.value);

    if (result.feedback) {
      this.strengthIndicatorTarget.innerText = result.feedback.warning;
      this.strengthIndicatorTarget.classList.remove("hidden");
    } else {
      this.strengthIndicatorTarget.classList.add("hidden");
    }
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bullet_train-fields-1.0.10 app/javascript/controllers/fields/password_controller.js
bullet_train-fields-1.0.8 app/javascript/controllers/fields/password_controller.js