{"version":3,"sources":["../js/directives/passwordStrength.js"],"names":["SUGApp","directive","templateUrl","restrict","scope","password","password2","styleoverride","controller","$scope","SUGUtilities","allTrue","obj","o","data","useglyph","APISyncCall","then","r","response","lowerCaseKeys","success","passwordComplexity","passwordValid","displayError","accountdetails","error","error_description","error_code","checkStrength","pass","pass2","ruletype","passwordLenValue","length","rule","enabled","minvalue","maxvalue","regexPattern","RegExp","pattern","test","link","element","attrs","$watch","strengthValue"],"mappings":"AAGAA,OAAOC,UAAU,mBAAoB,WACpC,MAAO,CACNC,YAAa,uCACbC,SAAU,KACVC,MAAO,CACNC,SAAU,IACVC,UAAW,IACXC,cAAe,GAChB,EACAC,WAAY,CAAC,SAAS,eAAgB,SAASC,EAAOC,GAcrD,SAASC,EAAQC,GAChB,IAAI,IAAIC,KAAKD,EACb,GAAG,CAACA,EAAIC,GACP,OAED,OAAO,CACR,CAnBAC,KAAO,GACPL,EAAOM,SAAW,SAClBL,EAAaM,YAAa,OAAQ,GAAIF,KAAM,0BAA2B,IAAM,EAC3EG,KAAK,SAASC,GACVC,EAAWT,EAAaU,cAAcF,EAAEJ,IAAI,EAC5CK,EAASE,SAGZZ,EAAOa,mBAAqBH,EAASL,KACrCL,EAAOc,cAAgB,IAHvBd,EAAOe,aAAaL,EAASL,KAAKW,eAAeC,MAAMP,EAASL,KAAKW,eAAeE,kBAAkBR,EAASL,KAAKW,eAAeG,UAAU,CAK/I,CAAC,EAUFnB,EAAOoB,cAAgB,SAASC,EAAMC,GACrC,IAESC,EAFLC,EAAmBH,EAAOrB,EAAOJ,SAAS6B,OAAS,EAEvD,IAASF,KAAYvB,EAAOa,mBAC3B,IAAK,IAAIa,KAAQ1B,EAAOa,mBAAmBU,GAE1C,GADAvB,EAAOc,cAAcY,GAAQ,CAAA,EACzB1B,EAAOa,mBAAmBU,GAAUG,GAAMC,QAC7C,OAAQD,GACP,IAAK,UACJ1B,EAAOc,cAAcY,GAAQF,GAAoBxB,EAAOa,mBAAmBU,GAAUG,GAAME,SAC3F,MACD,IAAK,UACJ5B,EAAOc,cAAcY,GAAQF,GAAoBxB,EAAOa,mBAAmBU,GAAUG,GAAMG,SAC3F,MACD,IAAK,QAIL,IAAK,QAIL,IAAK,SAIL,IAAK,cACJ,IAAIC,EAAe,IAAIC,OAAO/B,EAAOa,mBAAmBU,GAAUG,GAAMM,OAAO,EAC/EhC,EAAOc,cAAcY,GAAQI,CAAAA,CAAAA,EAAaG,KAAKZ,CAAI,CAErD,CAKH,OAAKnB,EAAQF,EAAOc,aAAa,GAAKO,IAASC,EAEpCpB,EAAQF,EAAOc,aAAa,GAAKU,EAAmB,GACvD,SACGtB,EAAQF,EAAOc,aAAa,GAAyB,IAApBU,EACpC,SADD,KAAA,EAHC,MAMT,CACD,GACAU,KAAM,SAASlC,EAAQmC,EAASC,GAC/BpC,EAAOqC,OAAQ,WAAY,WAC1BrC,EAAOsC,cAAgBtC,EAAOJ,SAAWI,EAAOoB,cAAcpB,EAAOJ,SAAUI,EAAOH,SAAS,EAAI,GAE7F,SADEG,EAAOsC,cAEbtC,EAAOM,SAAW,SAGlBN,EAAOM,SAAW,IAIrB,CAAC,CACF,CACD,CAED,CAAC","file":"passwordstrength.min.js","sourcesContent":["/**\r\n * used for customized file upload input fields\r\n **/\r\nSUGApp.directive('passwordStrength', function(){\r\n\treturn {\r\n\t\ttemplateUrl: '/js/directives/passwordStrength.html',\r\n\t\trestrict: 'EA',\r\n\t\tscope: {\r\n\t\t\tpassword: '@',\r\n\t\t\tpassword2: '@',\r\n\t\t\tstyleoverride: '@'\r\n\t\t},\r\n\t\tcontroller: ['$scope','SUGUtilities', function($scope,SUGUtilities) {\r\n\t\t\tdata = '';\r\n\t\t\t$scope.useglyph = 'remove';\r\n\t\t\tSUGUtilities.APISyncCall( \"post\", \"\", data, \"c.getPasswordComplexity\", 15000 )\r\n\t\t\t\t.then(function(r){\r\n\t\t\t\t\tvar response = SUGUtilities.lowerCaseKeys(r.data);\r\n\t\t\t\t\tif(!response.success) {\r\n\t\t\t\t\t\t$scope.displayError(response.data.accountdetails.error,response.data.accountdetails.error_description,response.data.accountdetails.error_code);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$scope.passwordComplexity = response.data;\r\n\t\t\t\t\t\t$scope.passwordValid = {};\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\tfunction allTrue(obj){\r\n\t\t\t\tfor(var o in obj)\r\n\t\t\t\tif(!obj[o]) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\r\n\t\t\t$scope.checkStrength = function(pass, pass2) {\r\n\t\t\t\tvar passwordLenValue = pass ? $scope.password.length : 0;\r\n\r\n\t\t\t\tfor (var ruletype in $scope.passwordComplexity){\r\n\t\t\t\t\tfor (var rule in $scope.passwordComplexity[ruletype]) {\r\n\t\t\t\t\t\t$scope.passwordValid[rule] = false;\r\n\t\t\t\t\t\tif ($scope.passwordComplexity[ruletype][rule].enabled) {\r\n\t\t\t\t\t\t\tswitch (rule) {\r\n\t\t\t\t\t\t\t\tcase \"minimum\":\r\n\t\t\t\t\t\t\t\t\t$scope.passwordValid[rule] = passwordLenValue >= $scope.passwordComplexity[ruletype][rule].minvalue ? true : false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase \"maximum\":\r\n\t\t\t\t\t\t\t\t\t$scope.passwordValid[rule] = passwordLenValue <= $scope.passwordComplexity[ruletype][rule].maxvalue ? true : false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase \"lower\":\r\n\t\t\t\t\t\t\t\t\tvar regexPattern = new RegExp($scope.passwordComplexity[ruletype][rule].pattern);\r\n\t\t\t\t\t\t\t\t\t$scope.passwordValid[rule] = regexPattern.test(pass) ? true : false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase \"upper\":\r\n\t\t\t\t\t\t\t\t\tvar regexPattern = new RegExp($scope.passwordComplexity[ruletype][rule].pattern);\r\n\t\t\t\t\t\t\t\t\t$scope.passwordValid[rule] = regexPattern.test(pass) ? true : false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase \"number\":\r\n\t\t\t\t\t\t\t\t\tvar regexPattern = new RegExp($scope.passwordComplexity[ruletype][rule].pattern);\r\n\t\t\t\t\t\t\t\t\t$scope.passwordValid[rule] = regexPattern.test(pass) ? true : false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase \"specialchar\":\r\n\t\t\t\t\t\t\t\t\tvar regexPattern = new RegExp($scope.passwordComplexity[ruletype][rule].pattern);\r\n\t\t\t\t\t\t\t\t\t$scope.passwordValid[rule] = regexPattern.test(pass) ? true : false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (!allTrue($scope.passwordValid) || pass !== pass2) {\r\n\t\t\t\t\treturn 'weak';\r\n\t\t\t\t} else if (allTrue($scope.passwordValid) && passwordLenValue < 10) {\r\n\t\t\t\t\treturn 'medium';\r\n\t\t\t\t} else if (allTrue($scope.passwordValid) && passwordLenValue >= 10) {\r\n\t\t\t\t\treturn 'strong';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}],\r\n\t\tlink: function($scope, element, attrs) {\r\n\t\t\t$scope.$watch( 'password', function() { \r\n\t\t\t\t$scope.strengthValue = $scope.password ? $scope.checkStrength($scope.password, $scope.password2) : '';\r\n\t\t\t\tswitch ($scope.strengthValue) {\r\n\t\t\t\t\tcase 'weak':\r\n\t\t\t\t\t\t$scope.useglyph = 'remove';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t$scope.useglyph = 'ok';\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t};\r\n\r\n});\r\n"]}