1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-09 11:30:00 +00:00
calibre-web/cps/static/js/libs/pwstrength/pwstrength-bootstrap.min.js

4 lines
14 KiB
JavaScript
Raw Normal View History

2022-06-16 06:33:39 +00:00
/* pwstrength-bootstrap 2021-10-29 - GPLv3 & MIT License */
!function(s){var t={};!function(o){"use strict";t.fallback={wordMinLength:"Your password is too short",wordMaxLength:"Your password is too long",wordInvalidChar:"Your password contains an invalid character",wordNotEmail:"Do not use your email as your password",wordSimilarToUsername:"Your password cannot contain your username",wordTwoCharacterClasses:"Use different character classes",wordRepetitions:"Too many repetitions",wordSequences:"Your password contains sequences",errorList:"Errors:",veryWeak:"Very Weak",weak:"Weak",normal:"Normal",medium:"Medium",strong:"Strong",veryStrong:"Very Strong"},t.t=function(r){var e="";return(e=o?o.t(r):t.fallback[r])===r?"":e}}(window.i18next);var r,c={};try{!s&&module&&module.exports&&(s=require("jquery"),r=require("jsdom").jsdom,s=s(r().defaultView))}catch(r){}!function(i){"use strict";var r={};c.forbiddenSequences=["0123456789","abcdefghijklmnopqrstuvwxyz","qwertyuiop","asdfghjkl","zxcvbnm","!@#$%^&*()_+"],r.wordNotEmail=function(r,e,o){return e.match(/^([\w!#$%&'*+\-/=?^`{|}~]+\.)*[\w!#$%&'*+\-/=?^`{|}~]+@((((([a-z0-9]{1}[a-z0-9-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?)$/i)?o:0},r.wordMinLength=function(r,e,o){var s=e.length,e=Math.pow(s,r.rules.raisePower);return s<r.common.minChar&&(e+=o),e},r.wordMaxLength=function(r,e,o){var s=e.length,e=Math.pow(s,r.rules.raisePower);return s>r.common.maxChar?o:e},r.wordInvalidChar=function(r,e,o){return r.common.invalidCharsRegExp.test(e)?o:0},r.wordMinLengthStaticScore=function(r,e,o){return e.length<r.common.minChar?0:o},r.wordMaxLengthStaticScore=function(r,e,o){return e.length>r.common.maxChar?0:o},r.wordSimilarToUsername=function(r,e,o){r=i(r.common.usernameField).val();return r&&e.toLowerCase().match(r.replace(/[-[\]/{}()*+=?:.\\^$|!,]/g,"\\$&").toLowerCase())?o:0},r.wordTwoCharacterClasses=function(r,e,o){r=new RegExp("(."+r.rules.specialCharClass+")");if(e.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)||e.match(/([a-zA-Z])/)&&e.match(/([0-9])/)||e.match(r)&&e.match(/[a-zA-Z0-9_]/))return o},r.wordRepetitions=function(r,e,o){return e.match(/(.)\1\1/)?o:0},r.wordSequences=function(r,o,e){var s,t=!1;return 2<o.length&&(i.each(c.forbiddenSequences,function(r,e){t||(e=[e,e.split("").reverse().join("")],i.each(e,function(r,e){for(s=0;s<o.length-2;s+=1)-1<e.indexOf(o.toLowerCase().substring(s,s+3))&&(t=!0)}))}),t)?e:0},r.wordLowercase=function(r,e,o){return e.match(/[a-z]/)&&o},r.wordUppercase=function(r,e,o){return e.match(/[A-Z]/)&&o},r.wordOneNumber=function(r,e,o){return e.match(/\d+/)&&o},r.wordThreeNumbers=function(r,e,o){return e.match(/(.*[0-9].*[0-9].*[0-9])/)&&o},r.wordOneSpecialChar=function(r,e,o){r=new RegExp(r.rules.specialCharClass);return e.match(r)&&o},r.wordTwoSpecialChar=function(r,e,o){r=new RegExp("(.*"+r.rules.specialCharClass+".*"+r.rules.specialCharClass+")");return e.match(r)&&o},r.wordUpperLowerCombo=function(r,e,o){return e.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)&&o},r.wordLetterNumberCombo=function(r,e,o){return e.match(/([a-zA-Z])/)&&e.match(/([0-9])/)&&o},r.wordLetterNumberCharCombo=function(r,e,o){r=new RegExp("([a-zA-Z0-9].*"+r.rules.specialCharClass+")|("+r.rules.specialCharClass+".*[a-zA-Z0-9])");return e.match(r)&&o},r.wordIsACommonPassword=function(r,e,o){return 0<=i.inArray(e,r.rules.commonPasswords)?o:0},c.validation=r,c.executeRules=function(t,n){var a=0;return i.each(t.rules.activated,function(r,e){var o,s;e&&(o=t.rules.scores[r],"function"==typeof(e="function"!=typeof(e=c.validation[r])?t.rules.extra[r]:e)&&((o=e(t,n,o))&&(a+=o),(o<0||!i.isNumeric(o)&&!o)&&0<(s=t.ui.spanError(t,r)).length&&t.instances.errors.push(s)))}),a}}(s);try{module&&module.exports&&(module.exports=c)}catch(r){}var u={common:{}};u.common.minChar=6,u.common.maxChar=20,u.common.usernameField="#username",u.common.invalidCharsRegExp=new RegExp(/[\s,'"]/),u.common.userInputs=[],u.common.onLoad=void 0,u.common.onKeyUp=void 0,u.common.onScore=void 0,u.common.zxcvbn=!1,u.common.zxcvbnTerms=[],u.common.events=["keyup","change","paste"],u.common.debug=!1,u.rules={},u.rules.extra={},u.rules.scores={wordNotEmail:-100,
//# sourceMappingURL=pwstrength-bootstrap.min.map