UNPKG

react-password-checker

Version:
1 lines 1.74 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.ReactPasswordChecker=e()}}(function(){return function e(t,n,o){function a(i,s){if(!n[i]){if(!t[i]){var d="function"==typeof require&&require;if(!s&&d)return d(i,!0);if(r)return r(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var u=n[i]={exports:{}};t[i][0].call(u.exports,function(e){var n=t[i][1][e];return a(n?n:e)},u,u.exports,e,t,n,o)}return n[i].exports}for(var r="function"==typeof require&&require,i=0;i<o.length;i++)a(o[i]);return a}({1:[function(e,t,n){(function(e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,a=o.createClass({displayName:"ReactPasswordChecker",getInitialState:function(){return{validationMessage:""}},checkPassword:function(e){var t=e.target.value,n=/^[a-zA-Z0-9_-]{6,18}$/;n.test(t)?this.setState({validationMessage:"Your password is valid"}):this.setState({validationMessage:"Your password needs to be 6-18 characters and contain at least a lowercase letter (a-z), number (0-9), an underscore, or a hyphen"})},render:function(){return o.createElement("div",null,o.createElement("input",{type:"text",placeholder:"Check your password",onChange:this.checkPassword}),""!==this.state.validationMessage?this.state.validationMessage:"")}});n["default"]=a,t.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});