Sha256: 5e92ae61a4be4b2747a1543fe3a7f563c6932f73b0b698adf74361a2e62124d2

Contents?: true

Size: 475 Bytes

Versions: 1

Compression:

Stored size: 475 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

1 entries across 1 versions & 1 rubygems

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