Article ID: 118342, created on Nov 1, 2013, last review on May 10, 2014

  • Applies to:
  • APS 2.x


I am trying to use the aps/Password widget in my application.

By default, it only takes into account password length when setting password complexity.

How do I replace that with my own password complexity calculation logic?


You should create your own 'calcStrength' method.

For example, this is how I can make my widget set maximum password complexity when user enters 'password' for password and minimum in all other cases:

 <script src="/aps/2/ui/runtime/client/aps/aps.js"></script>
  require(["dojo/parser", "aps/Password", "aps/ready!"], function(parser, Password){
    pwd = new Password();
    pwd.calcStrength = function(value){return (value == "password") ? this.classesMap.length : 0; };
    pwd.placeAt("body", "last");
 <div dojoType="aps/PageContainer">
     <div id="body"></div>

Refer to the aps/Password widget documentation page page for more information.

717db81efe94e616312b74fb03a5d474 70bf700e0cdb9d7211df2595ef7276ab

Email subscription for changes to this article
Save as PDF