Skip to content
This repository was archived by the owner on Oct 10, 2019. It is now read-only.

nd-roy/loopback-mixin-complexity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Complexity

dependencies Status devDependencies Status

This module is designed for the Strongloop Loopback framework. It allows of any Model to validate the complexity of a field. It can help to builds regular expressions based on common settings for passwords, username, and other user identification methods.

Install

  npm install --save loopback-mixin-complexity

Model configuration

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-mixin-complexity",
      "../common/mixins"
    ]
  }
}

Configure

To use with your Models add the mixins attribute to the definition object of your model config.

    "Complexity": {
      "fields" : {
        "password" : {   
          "uppercase": 1,    // A through Z
          "lowercase": 1,    // a through z
          "special": 0,      // ! @ # $ & *
          "digit": 1,        // 0 through 9
          "alphaNumeric": 1, // a through Z
          "min": 6,          // minumum number of characters
          "max": 16,         // silly idea to have maximum...
          "exact": 20        // match the exact number of characters
        }
      }
    },

About

Loopback string validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors