PageSourceSearch

https://wheregoes.com/c/themes/custom-theme/src/js/login.js?ver=20260925194

js wheregoes.com collected 2026-09-25 19:11:47 UTC 4,489 bytes, 142 lines download raw bytes

1/**
2 * Main Theme JS Variable
3 */
4customTheme = (typeof customTheme === 'undefined') ? {} : customTheme;
5
6/**
7 * Login Library
8 * @type {{}}
9 */
10customTheme.login = {
11
12    /**
13     * Updates the count to the left of a password field
14     */
15    updateCounter: function () {
16        let passwordField = jQuery(this);
17        let wrapper = passwordField.closest('.password-w');
18        let counter = wrapper.find('.count');
19        let value = passwordField.val();
20        // Update counter
21        counter.html(value.length);
22    },
23
24    /**
25     * Toggles the hidden password to be visible and vise versa
26     */
27    togglePassword : function(){
28        let toggleButton = jQuery(this);
29        let wrapper = toggleButton.closest('.password-w');
30        let passwordField = wrapper.find('input');
31
32        if ( toggleButton.hasClass('icon-eye-off') ){
33            console.log('off');
34            // Show Password
35            toggleButton.removeClass('icon-eye-off');
36            toggleButton.addClass('icon-eye');
37            passwordField.attr('type', 'text');
38        } else {
39            console.log('on');
40            // Hide Password
41            toggleButton.removeClass('icon-eye');
42            toggleButton.addClass('icon-eye-off');
43            passwordField.attr('type', 'password');
44        }
45    },
46
47    /**
48     * Check to see if the first password field meets all the requirements
49     */
50    checkPasswordRequirements: function () {
51
52        let requirements = jQuery('#password-requirements');
53        let thisForm = requirements.closest('form');
54        let pass1 = thisForm.find('input[name=pass1]');
55        let pass1Val = pass1.val();
56        let pass2 = thisForm.find('input[name=pass2]');
57
58        let good = 0;
59
60        // Clear Requirements Meter
61        requirements.find('.special, .numbers, .lowercase, .uppercase, .length, .match').removeClass('good warning');
62
63        // Special Chars
64        if (pass1Val.match(/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/)) {
65            requirements.find('.special').addClass('good');
66            good++;
67        }
68        // Numbers
69        if (pass1Val.match(/[0-9]+/)) {
70            requirements.find('.numbers').addClass('good');
71            good++;
72        }
73        // Lower Case
74        if (pass1Val.match(/[a-z]+/)) {
75            requirements.find('.lowercase').addClass('good');
76            good++;
77        }
78        // Uppercase
79        if (pass1Val.match(/[A-Z]+/)) {
80            requirements.find('.uppercase').addClass('good');
81            good++;
82        }
83        // Min Length
84        if (pass1Val.length >= 10) {
85            requirements.find('.length').addClass('good');
86            good++;
87        }
88
89        if (good > 4) {
90            pass2.attr('disabled', false);
91
92            // Check if the passwords match
93            customTheme.login.checkPasswordMatch();
94        } else {
95            // Disable Retype Password
96            pass2.attr('disabled', true);
97        }
98
99    },
100
101    checkPasswordMatch: function () {
102
103        let requirements = jQuery('#password-requirements');
104        let thisForm = requirements.closest('form');
105        let pass1 = thisForm.find('input[name=pass1]');
106        let pass1Val = pass1.val();
107        let pass2 = thisForm.find('input[name=pass2]');
108        let pass2Val = pass2.val();
109
110        // Clear Requirements Meter
111        requirements.find('.match').removeClass('good error');
112
113        thisForm.find('input[type=submit]').attr('disabled', true);
114
115        // Match
116        if (pass1Val == pass2Val) {
117            requirements.find('.match').addClass('good');
118            thisForm.find('input[type=submit]').attr('disabled', false);
119        } else {
120            // Compare each letter 1 to 1 to catch a mismatch
121            for (let i = 0; i < pass2Val.length; i++) {
122                if (pass1Val.charAt(i) != pass2Val.charAt(i)) {
123                    requirements.find('.match').addClass('error');
124                    break;
125                }
126            }
127        }
128
129    }
130
131}
132
133// Page Loaded
134jQuery(document).ready(function () {
135
136    // Password Requirements
137    jQuery('.login-w').on('change keyup input', 'input[name=pass1]', customTheme.login.checkPasswordRequirements);
138    jQuery('.login-w').on('change keyup input', 'input[name=pass2]', customTheme.login.checkPasswordMatch);
139    jQuery('.password-w').on('change keyup input', 'input', customTheme.login.updateCounter);
140    jQuery('.password-w').on('click', '.toggle', customTheme.login.togglePassword );
141});
142

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.