Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-password-validator-v2

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-password-validator-v2

The password validator is a pop-up window that appears when you start typing in input box. Here you can configure the password acceptance criteria, once your enter characters fullfil the requirement you will get a success message.

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Password validator for Angular

npm GitHub Contributors GitHub language count npm bundle size GitHub repo size npm NPM GitHub last commit contributions welcome

The password validator is a pop-up window that appears when you start typing in input box. Here you can configure the password acceptance criteria, once your enter characters fullfil the requirement you will get a success message.

Help to make Password Validator better by answering a few questions.

Demo

https://jaganbishoyi.github.io/ngx-password-validator/

Installation

Install the npm package.

npm i ng-password-validator

Import in NgModule:

import { NgPasswordValidatorModule } from 'ng-password-validator';

@NgModule({
    imports: [ NgPasswordValidatorModule ]
})

Usage

Options can be set in the directive tag, so they have the highest priority.

<input type="text" id="password" name="password" placeholder="Password.."
    NgPasswordValidator placement="top">

You may pass as an object:

<input type="text" id="password" name="password" placeholder="Password.."
    [NgPasswordValidator]="options">

Password type as 'range':

options = {
    'placement': 'top',
    'password': {
        'type': "range";
        'min': 6;
        'max': 10;
    },
    'shadow': false,
    'offset': 15,
}

Password type as 'number':

options = {
    'placement': 'top',
    'password': {
        'type': "number";
        'length': 8;
    },
    'shadow': false,
    'offset': 15,
}

Theming( Default value is pro ):

<input type="text" id="password" name="password" placeholder="Password.."
    [NgPasswordValidator]="options">

Theme as 'basic':

options = {
    'placement': 'top',
    'theme': 'basic'
}

Theme as 'pro':

options = {
    'placement': 'top',
    'theme': 'pro'
}

You can also change Popup header and success message:

<input type="text" id="password" name="password" placeholder="Password.."
    [NgPasswordValidator]="options">
options = {
    'heading': 'Password Requirement',
    'successMessage': 'Wow! Password is Strong.'
}

After closing the popup window, you will get one output for password validity (true/false):

<input type="text" id="password" name="password" placeholder="Password.."
    NgPasswordValidator placement="top" (valid)="isValid($event)">
isValid(event: boolean) {
    this.isPasswordValid = event;
}

Set default values

In app.module.ts export the default options like below:

import { NgPasswordValidatorModule, NgPasswordValidatorOptions } from "ng-password-validator";

export const MyDefaultOptions: NgPasswordValidatorOptions = {
    placement: "right",
    rules: {
        "include-symbol": true,
        "include-number": true,
        "include-lowercase-characters": true,
        "include-uppercase-characters": false,
    }
};

And pass your parameters when importing the module:

@NgModule({
    imports: [
      NgPasswordValidatorModule.forRoot(MyDefaultOptions as NgPasswordValidatorOptions)
    ]
})

Properties

nametypedefaultdescription
placement"top", "bottom", "left", "right""bottom"The position of the popup window.
z-indexnumber0Z-index of the popup window.
trigger"focus"Specifies how the popup window is triggered.
popup-classstringClasses to be passed to the popup window.
headingstringPassword PolicyHeading of popup window.
successMessagestringAwesome! Password requirement fulfilled.Success message after requirements fulfilled.
animation-durationnumber300The duration controls how long the animation takes to run from start to finish.
theme"basic""basic"Theme of popup window background and text.
shadowbooleantrueShadow of the popup window.
offsetnumber8Offset the popup window relative to the item.
widthnumberundefinedWidth of the popup window.
max-widthnumber390Maximum width of the popup window.
pointerEvents"auto", "none""none"Defines whether or not an element reacts to pointer events.
position{top: number, left: number}undefinedThe popup window coordinates relative to the browser window.

Events

When you call events, the delays that are specified in the options in the directive are taken into account.

EventDescription
{type: "show", position: DOMRect}The event is called before the popup window appears.
{type: "shown", position: DOMRect}The event is called after the animation of the appearance of the popup window.
{type: "hide", position: DOMRect}The event is called before the popup window is hidden.
{type: "hidden", position: DOMRect}The event is called after the animation of the popup window is hidden.

For any questions, suggestions, or feature requests

Please file an issue!

License

License under the MIT License (MIT)

Copyright (c) 2020-2021 Jagan Mohan Bishoyi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 26 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc