New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ngx-pwd

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-pwd

A simple password strength meter and generator

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

NgxPwd

  • Password strength meter with generator all in one

Installation

npm i ngx-pwd

API

import { NgxPwdModule } from 'ngx-pwd';

@Service

import { NgxPwdService } from 'ngx-pwd';

MethodParamRequiredDescription
generatelengthDefaults: 8return random password
validatepasswordYESreturns true if password passed the rules

@Inputs()

InputTypeRequiredDescription
passwordstringYESPassword to check
validObservableOptionalreturns if password is valid
optionsobjectNONgxPwdOptions

@Output()

OutputTypeRequiredDescription
useRecPWCallbackNOEmits the generated password back to the parent component

NgxPwdOptions

OptionsTypeRequiredDescription
lengthNumberDefaults: 8Generated password length
colorStringDefaults: #18b4d7Background color of bullet when passed
hideAfterUseBooleanDefaults: falseWhether to hide generated password after used

Sample Usage

  • Register the NgxPwdModule in your app module.

import { NgxPwdModule } from 'ngx-pwd'

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { NgxPwdModule } from 'ngx-pwd';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxPwdModule,
    FormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})

  • Declare the options on yout app.component.ts
import { Component } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'ngx-pwd';

  valid: BehaviorSubject<any> = new BehaviorSubject(false);
  password = '';

  options = {
    length: 10,
    hideAfterUse: true
  };

  useRecPwd (pwd: string) {
    this.password = pwd;
  }
}

  • Use the component <ngx-pwd></ngx-pwd> in your component.
<div class="ngx-pwd-demo">
  <div class="ngx-pwd-demo-form">
    <p>NgxPwdModule Demo</p>

    <div class="ngx-pwd-demo-input">
      <input type="text" [(ngModel)]="password" placeholder="enter your password">
    </div>

    <div class="ngx-pwd-demo-component">
      <ngx-pwd [options]="options" [password]="password" [valid]="valid" (useRecPW)="useRecPwd($event)"></ngx-pwd>
    </div>
  </div>
</div>

Thanks to all resources

Keywords

password

FAQs

Package last updated on 13 Jun 2020

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