PageSourceSearch

https://panel.eth-services.de/assets/js/PasswordStrength.js

js eth-services.de collected 2026-10-04 15:01:21 UTC 4,134 bytes, 90 lines download raw bytes

1jQuery(document).ready(function(){
2    if(typeof window.langPasswordWeak === 'undefined'){
3        window.langPasswordWeak = "Weak";
4    }
5    if(typeof window.langPasswordModerate === 'undefined'){
6        window.langPasswordModerate = "Moderate";
7    }
8    if(typeof window.langPasswordStrong === 'undefined'){
9        window.langPasswordStrong = "Strong";
10    }
11
12    jQuery("#newpw").keyup(function () {
13        var pwvalue = jQuery("#newpw").val();
14        var pwstrength = getPasswordStrength(pwvalue);
15        jQuery("#pwstrength").html(langPasswordStrong);
16        jQuery("#pwstrengthpos").css("background-color","#33CC00");
17
18        var errorThreshold = !isNaN(parseInt(jQuery(this).data('error-threshold'))) ? jQuery(this).data('error-threshold') : 50;
19        var warningThreshold = !isNaN(parseInt(jQuery(this).data('warning-threshold'))) ? jQuery(this).data('warning-threshold') : 75;
20
21        if (pwstrength<warningThreshold) {
22            jQuery("#pwstrength").html(langPasswordModerate);
23            jQuery("#pwstrengthpos").css("background-color","#ff6600");
24        }
25        if (pwstrength<errorThreshold) {
26            jQuery("#pwstrength").html(langPasswordWeak);
27            jQuery("#pwstrengthpos").css("background-color","#cc0000");
28        }
29        jQuery("#pwstrengthpos").css("width",pwstrength);
30        jQuery("#pwstrengthneg").css("width",100-pwstrength);
31    });
32});
33
34function registerFormPasswordStrengthFeedback()
35{
36    passwordStrength = getPasswordStrength(jQuery(this).val());
37
38    var errorThreshold = !isNaN(parseInt(jQuery(this).data('error-threshold'))) ? jQuery(this).data('error-threshold') : 50;
39    var warningThreshold = !isNaN(parseInt(jQuery(this).data('warning-threshold'))) ? jQuery(this).data('warning-threshold') : 75;
40
41    if (passwordStrength >= warningThreshold) {
42        textLabel = langPasswordStrong;
43        cssClass = 'success';
44    } else if (passwordStrength >= errorThreshold) {
45        textLabel = langPasswordModerate;
46        cssClass = 'warning';
47    } else {
48        textLabel = langPasswordWeak;
49        cssClass = 'danger';
50    }
51    jQuery("#passwordStrengthTextLabel").html(langPasswordStrength + ': ' + passwordStrength + '% ' + textLabel);
52    jQuery("#passwordStrengthMeterBar").css('width', passwordStrength + '%').attr('aria-valuenow', passwordStrength);
53    var ver = parseInt($.fn.tooltip.Constructor.VERSION);
54    switch (ver) {
55        case 3:
56            jQuery("#passwordStrengthMeterBar").removeClass('progress-bar-success progress-bar-warning progress-bar-danger').addClass('progress-bar-' + cssClass);
57            break;
58        default:
59            jQuery("#passwordStrengthMeterBar").removeClass('bg-danger bg-warning bg-success').addClass('bg-' + cssClass);
60            break;
61    }
62}
63
64function getPasswordStrength(pw){
65    var pwlength=(pw.length);
66    if(pwlength>5)pwlength=5;
67    var numnumeric=pw.replace(/[0-9]/g,"");
68    var numeric=(pw.length-numnumeric.length);
69    if(numeric>3)numeric=3;
70    var symbols=pw.replace(/\W/g,"");
71    var numsymbols=(pw.length-symbols.length);
72    if(numsymbols>3)numsymbols=3;
73    var numupper=pw.replace(/[A-Z]/g,"");
74    var upper=(pw.length-numupper.length);
75    if(upper>3)upper=3;
76    var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
77    if(pwstrength<0){pwstrength=0}
78    if(pwstrength>100){pwstrength=100}
79    return pwstrength;
80}
81
82function showStrengthBar() {
83    if(typeof window.langPasswordStrength === 'undefined'){
84        window.langPasswordStrength = "Password Strength";
85    }
86    if(typeof window.langPasswordWeak === 'undefined'){
87        window.langPasswordWeak = "Weak";
88    }
89    document.write('<table align="center" style="width:auto;"><tr><td>'+langPasswordStrength+':</td><td><div id="pwstrengthpos" style="position:relative;float:left;width:0px;background-color:#33CC00;border:1px solid #000;border-right:0px;">&nbsp;</div><div id="pwstrengthneg" style="position:relative;float:left;width:100px;background-color:#efefef;border:1px solid #000;border-left:0px;">&nbsp;</div></td><td><div id="pwstrength">'+langPasswordWeak+'</div></td></tr></table>');
90}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.