import Bind from "@web-atoms/core/dist/core/Bind"; import XNode from "@web-atoms/core/dist/core/XNode"; import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl"; import { IPasswordValidation, Validators } from "../validators/Validators"; export default class PasswordStrength extends AtomControl { public password: string = ""; public validation: IPasswordValidation = { hasMinimumLength: false, hasNumber: false, hasSymbol: false, isValid: false }; protected preCreate(): void { this.render(
Validators.checkPassword(this.password))}>
this.validation.hasMinimumLength ? "green" : "red")} class={Bind.oneWay(() => this.validation.hasMinimumLength ? "fas fa-check" : "fas fa-times")}/>
this.validation.hasNumber ? "green" : "red")} class={Bind.oneWay(() => this.validation.hasNumber ? "fas fa-check" : "fas fa-times")}/>
this.validation.hasSymbol ? "green" : "red")} class={Bind.oneWay(() => this.validation.hasSymbol ? "fas fa-check" : "fas fa-times")}/>
); } }