PageSourceSearch

https://kultur-leipzigerraum.de/register-login/media/js/register-login-password.js

js kultur-leipzigerraum.de collected 2026-10-04 20:46:34 UTC 8,092 bytes, 230 lines download raw bytes

1function validateRegisterPasswordLayerPasswordFields() {
2    $valid = true;
3    $password = $('input[name="new_password"]').val();
4
5    $('.password-not-same-error, .password-not-strong-error').hide();
6
7    var strengthRequired = 0;
8    var strength = 0;
9    var arrRequired = [/.{10,}/];
10    jQuery.map(arrRequired, function (regexp) {
11        if ($password.match(regexp))
12            strengthRequired++;
13    });
14    var arr = [/.{10,}/, /[a-z]+/, /[0-9]+/, /[A-Z]+/];
15    jQuery.map(arr, function (regexp) {
16        if ($password.match(regexp))
17            strength++;
18    });
19
20    if (strengthRequired < 1 || strength < 4) {
21        $valid = false;
22        $('.password-not-strong-error').fadeIn(666);
23        $('input.register-password').addClass('has-error');
24    }
25
26    return $valid;
27}
28
29function validateTermsOfUseSwitch() {
30    $valid = false;
31    $valid = $(".accept-terms-of-use-checkbox").bootstrapSwitch('state');
32
33    return $valid;
34}
35
36function isEmailRegisterPasswordLayer(email) {
37    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
38    return regex.test(email);
39}
40
41function closeRegisterPasswordLayer() {
42    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
43    $('.register-login-layer').html('');
44}
45
46function registerRegisterPasswordLayerMenuButton() {
47    // CLOSE BUTTON
48    $('button.register-login-layer-close-button').on('click', function () {
49        closeRegisterPasswordLayer();
50    });
51
52    // TAB BUTTONS
53    $('button.menu-button').on('click', function () {
54        var nextTabId = $(this).data('tab-id');
55        $('button.menu-button').removeClass('active');
56        $(this).addClass('active');
57        $('.register-login-layer-tab').removeClass('active');
58        $('.register-login-layer-tab[data-tab-id="' + nextTabId + '"]').addClass('active');
59
60        switch (nextTabId) {
61            case 1:
62                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
63                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="1"]').addClass('active');
64                $('.register-login-layer-tab[data-tab-id="1"] input[name="barcode"]').focus();
65                break;
66            case 2:
67                $('.register-login-layer-tab[data-tab-id="2"] input[name="email"]').focus();
68                break;
69        }
70    });
71}
72
73function updateMenuButtonTextRegisterPasswordLayer() {
74    $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text'));
75}
76
77function registerRegisterPasswordLayerContainerButtons() {
78
79    // LOGIN BUTTON
80    function changePasswordRegisterLogin() {
81        if (validateRegisterPasswordLayerPasswordFields() && validateTermsOfUseSwitch()) {
82            var body = {
83                m: 'change_password',
84                account: $('input[name="account"]').val(),
85                password: $('input[name="new_password"]').val(),
86                project: $('.register-login-layer').data('project'),
87                language_id: ENV.id_language,
88                term_of_use_state: validateTermsOfUseSwitch()
89            };
90
91
92
93            CbUx.showLoader();
94            $.post("/register-login/api/register_password", body, function (data) {
95                console.log("Data from register_passwort: ", data);
96                CbUx.hideLoader();
97                console.log("DATA IN changePasswordRegisterLogin: " , data);
98                if (data.success === true) {
99                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
100                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="202"]').addClass('active');
101                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="202"] .ml-headline').html(data.data.headline);
102                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="202"] .ml-text').html(data.data.text);
103                    updateMenuButtonTextRegisterPasswordLayer();
104                } else {
105                    $('.wrong-password-message').html(data.message).show();
106                }
107            });
108        }
109    }
110
111    $('button.change-password-button').on('click', function () {
112        changePasswordRegisterLogin();
113    });
114
115    $('input[name="password"]').on('keypress', function (e) {
116        if (e.which == 13) {
117            changePasswordRegisterLogin();
118        }
119    });
120
121    // LOGIN SUCCESS BUTTON
122    $('button.change-password-success-button').on('click', function () {
123        window.history.replaceState(null, null, "/"); //  DOES NOT WORK ON DEV
124               closeRegisterPasswordLayer();
125        CbUx.showLoader();
126        window.location.reload();
127    });
128
129    // MY PROFILE BUTTON
130    $('button.my-profile-button').on('click', function () {
131        closeRegisterPasswordLayer();
132        window.location.hash = '#profile';
133        window.location.reload();
134    });
135
136    $(".register-password").focus(function () {
137        $('.password-not-strong-error').fadeIn(666);
138        $('input.register-password').removeClass('has-error');
139    });
140
141    $(".register-password").focusout(function () {
142        setTimeout(function () {
143            $('.password-not-strong-error').fadeOut(40);
144        }, 333);
145    });
146
147
148    // TOGGLE PASSWORD 
149    $(".toggle-password").click(function () {
150        $(this).toggleClass("fa-eye fa-eye-slash");
151        var input = $('input[name="new_password"]');
152        if (input.attr("type") == "password") {
153            input.attr("type", "text");
154        } else {
155            input.attr("type", "password");
156        }
157    });
158}
159
160function registerRegisterPasswordLayerButtons() {
161    registerRegisterPasswordLayerMenuButton();
162    registerRegisterPasswordLayerContainerButtons();
163}
164
165function openRegisterPasswordLayer() {
166    console.log("openRegisterPasswordLayer CALLED");
167    var body = {
168        m: "register_password_layer",
169        project: $('.register-login-layer').data('project'),
170        language_id: ENV.id_language,
171        page_path: window.location.origin + window.location.pathname
172    };
173
174    CbUx.showLoader();
175    $.get("/register-login/api/register_password", body, function (data) {
176        CbUx.hideLoader();
177        $('.register-login-layer').html(data);
178        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
179
180        registerRegisterPasswordLayerButtons();
181        $('nav .menu-button.active').focus();
182        updateMenuButtonTextRegisterPasswordLayer();
183
184        //generate Terms of Use Switch
185        $('.accept-terms-of-use-checkbox').bootstrapSwitch({
186            'labelText': '<span class="flip-switch-handle"></span>',
187            'handleWidth': 19,
188            'labelWidth': 26,
189        });
190        
191        //enable / disable "Save new password" button
192        $(".accept-terms-of-use-checkbox").on("switchChange.bootstrapSwitch", function (event, state) {
193            if (state) {
194                $(".change-password-button").prop("disabled", false);
195
196            } else {
197                $(".change-password-button").prop("disabled", true);
198            }
199        });
200    });
201
202    if ($('#film-sile-layer-close-button').length > 0) {
203        $('#film-sile-layer-close-button').click();
204    }
205
206}
207
208function getUrlParameter(sParam) {
209    var sPageURL = window.location.search.substring(1),
210            sURLVariables = sPageURL.split('&'),
211            sParameterName,
212            i;
213
214    for (i = 0; i < sURLVariables.length; i++) {
215        sParameterName = sURLVariables[i].split('=');
216
217        if (sParameterName[0] === sParam) {
218            return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
219        }
220    }
221    return false;
222}
223;
224
225$(document).ready(function () {
226    $('.register-password-layer-button').on('click', $('body'), function () {
227        openRegisterPasswordLayer();
228    });
229
230});

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.