PageSourceSearch

https://www.esmn-cost.eu/wp-content/plugins/wp-front-end-login-and…/wp-mp-register-login-public.js?ver=2.0.0

js esmn-cost.eu collected 2026-10-07 03:39:37 UTC 16,276 bytes, 446 lines download raw bytes

1(function($) {
2    'use strict';
3
4    $(document).ready(initScript);
5
6    function initScript() {
7
8        //defing global ajax post url
9        window.ajaxPostUrl = ajax_object.ajax_url;
10        // validating login form request
11        wpmpValidateAndProcessLoginForm();
12        // validating registration form request
13        wpmpValidateAndProcessRegisterForm();
14        // validating reset password form request
15        wpmpValidateAndProcessResetPasswordForm();
16        //Show Reset password
17        wpmpShowResetPasswordForm();
18        // validating Profile form request
19        wpmpValidateAndProcessProfileForm();
20        //Return to login
21        wpmpReturnToLoginForm();
22        generateCaptcha();
23
24    }
25
26    // Validate login form
27    function wpmpValidateAndProcessLoginForm() {
28        $('#wpmpLoginForm').formValidation({
29            message: 'This value is not valid',
30            icon: {
31                valid: 'glyphicon glyphicon-ok',
32                invalid: 'glyphicon glyphicon-remove',
33                validating: 'glyphicon glyphicon-refresh'
34            },
35            fields: {
36                wpmp_username: {
37                    message: 'The username is not valid',
38                    validators: {
39                        notEmpty: {
40                            message: 'The username is required.'
41                        }
42                    }
43                },
44                wpmp_password: {
45                    validators: {
46                        notEmpty: {
47                            message: 'The password is required.'
48                        }
49                    }
50                }
51            }
52        }).on('success.form.fv', function(e) {
53            $('#wpmp-login-alert').hide();
54            // You can get the form instance
55            var $loginForm = $(e.target);
56            // and the FormValidation instance
57            var fv = $loginForm.data('formValidation');
58            var content = $loginForm.serialize();
59
60            // start processing
61            $('#wpmp-login-loader-info').show();
62            wpmpStartLoginProcess(content);
63            // Prevent form submission
64            e.preventDefault();
65        });
66    }
67
68    // Make ajax request with user credentials
69    function wpmpStartLoginProcess(content) {
70
71        var loginRequest = jQuery.ajax({
72            type: 'POST',
73            url: ajaxPostUrl,
74            data: content + '&action=wpmp_user_login',
75            dataType: 'json',
76            success: function(data) {
77                $('#wpmp-login-loader-info').hide();
78                // check login status
79                if (true == data.logged_in) {
80                    $('#wpmp-login-alert').removeClass('alert-danger');
81                    $('#wpmp-login-alert').addClass('alert-success');
82                    $('#wpmp-login-alert').show();
83                    $('#wpmp-login-alert').html(data.success);
84
85                    // redirect to redirection url provided
86                    window.location = data.redirection_url;
87
88                } else {
89
90                    $('#wpmp-login-alert').show();
91                    $('#wpmp-login-alert').html(data.error);
92
93                }
94            },
95            error: function(data) {
96                console.log(data);
97            }
98        });
99    }
100
101    //Validate profile update
102    function wpmpValidateAndProcessProfileForm() {
103        $('#wpmpProfileForm').formValidation({
104            message: 'This value is not valid',
105            icon: {
106                required: 'glyphicon glyphicon-asterisk',
107                valid: 'glyphicon glyphicon-ok',
108                invalid: 'glyphicon glyphicon-remove',
109                validating: 'glyphicon glyphicon-refresh'
110            },
111            fields: {
112                wpmp_fname: {
113                    validators: {
114                        notEmpty: {
115                            message: 'The first name is required'
116                        },
117                        stringLength: {
118                            max: 30,
119                            message: 'The firstname must be less than 30 characters long'
120                        }
121                    }
122                },                
123                wpmp_email: {
124                    validators: {
125                        notEmpty: {
126                            message: 'The email is required'
127                        },
128                        regexp: {
129                            regexp: '^[^@\\s]+@([^@\\s]+\\.)+[^@\\s]+$',
130                            message: 'The value is not a valid email address'
131                        }
132                    }
133                },
134            }
135        }).on('success.form.fv', function(e) {
136            e.preventDefault();
137            $('#wpmp-profile-alert').hide();           
138            $('body, html').animate({
139                scrollTop: 0
140            }, 'slow');
141            // You can get the form instance
142            $('#wpmp-profile-loader-info').show();
143            var formdata = new FormData($("#wpmpProfileForm")[0]);
144            formdata.append('action', 'updateProfile');
145            jQuery.ajax({
146              url:ajax_object.ajax_url, 
147              data:formdata,
148              method:"POST",
149              processData: false,
150              contentType: false,
151              success:function(data){  
152                $('#wpmp-profile-loader-info').hide();
153                 if (true == data.reg_status) {
154                    $('#wpmp-profile-alert').removeClass('alert-danger');
155                    $('#wpmp-profile-alert').addClass('alert-success');
156                    $('#wpmp-profile-alert').show();
157                    $('#wpmp-profile-alert').html(data.success);
158
159                } else {
160                    $('#wpmp-profile-alert').addClass('alert-danger');
161                    $('#wpmp-profile-alert').show();
162                    $('#wpmp-profile-alert').html(data.error);
163
164                }
165              }
166          });
167        }).on('err.form.fv', function(e) {
168            console.log("ddd");
169        });
170    }
171
172
173    // Validate registration form
174
175
176    function randomNumber(min, max) {
177        return Math.floor(Math.random() * (max - min + 1) + min);
178    }
179
180    function generateCaptcha() {
181        $('#captchaOperation').html([randomNumber(1, 100), '+', randomNumber(1, 200), '='].join(' '));
182    }
183
184    // Validate registration form
185    function wpmpValidateAndProcessRegisterForm() {
186        $('#wpmpRegisterForm').formValidation({
187            message: 'This value is not valid',
188            icon: {
189                required: 'glyphicon glyphicon-asterisk',
190                valid: 'glyphicon glyphicon-ok',
191                invalid: 'glyphicon glyphicon-remove',
192                validating: 'glyphicon glyphicon-refresh'
193            },
194            fields: {
195                wpmp_fname: {
196                    validators: {
197                        notEmpty: {
198                            message: 'The first name is required'
199                        },
200                        stringLength: {
201                            max: 30,
202                            message: 'The firstname must be less than 30 characters long'
203                        },
204                        regexp: {
205                            regexp: /^[a-zA-Z]*$/,
206                            message: 'Only characters are allowed.'
207                        }
208                    }
209                },
210                wpmp_username: {
211                    message: 'The username is not valid',
212                    validators: {
213                        notEmpty: {
214                            message: 'The username is required'
215                        },
216                        stringLength: {
217                            min: 6,
218                            max: 30,
219                            message: 'The username must be more than 6 and less than 30 characters long'
220                        },
221                        regexp: {
222                            regexp: /^[a-zA-Z0-9_\.]+$/,
223                            message: 'The username can only consist of alphabetical, number, dot and underscore'
224                        }
225                    }
226                },
227                wpmp_email: {
228                    validators: {
229                        notEmpty: {
230                            message: 'The email is required'
231                        },
232                        regexp: {
233                            regexp: '^[^@\\s]+@([^@\\s]+\\.)+[^@\\s]+$',
234                            message: 'The value is not a valid email address'
235                        }
236                    }
237                },
238                wpmp_password: {
239                    validators: {
240                        notEmpty: {
241                            message: 'The password is required'
242                        },
243                        stringLength: {
244                            min: 6,
245                            message: 'The password must be more than 6 characters long'
246                        }
247                    }
248                },
249                wpmp_password2: {
250                    validators: {
251                        notEmpty: {
252                            message: 'The password is required'
253                        },
254                        identical: {
255                            field: 'wpmp_password',
256                            message: 'The password and its confirm are not the same'
257                        },
258                        stringLength: {
259                            min: 6,
260                            message: 'The password must be more than 6 characters long'
261                        }
262                    }
263                },
264                wpmp_captcha: {
265                    validators: {
266                        callback: {
267                            message: 'Wrong answer',
268                            callback: function(value, validator, $field) {
269                                var items = $('#captchaOperation').html().split(' '),
270                                        sum = parseInt(items[0]) + parseInt(items[2]);
271                                return value == sum;
272                            }
273                        }
274                    }
275                }
276            }
277        }).on('success.form.fv', function(e) {
278            $('#wpmp-register-alert').hide();
279            $('#wpmp-mail-alert').hide();
280            $('body, html').animate({
281                scrollTop: 0
282            }, 'slow');
283            // You can get the form instance
284            var $registerForm = $(e.target);
285            // and the FormValidation instance
286            var fv = $registerForm.data('formValidation');
287            var content = $registerForm.serialize();
288
289            // start processing
290            $('#wpmp-reg-loader-info').show();
291            wpmpStartRegistrationProcess(content);
292            // Prevent form submission
293            e.preventDefault();
294        }).on('err.form.fv', function(e) {
295            // Regenerate the captcha
296            generateCaptcha();
297        });
298    }
299
300
301    // Make ajax request with user credentials
302    function wpmpStartRegistrationProcess(content) {
303
304        var registerRequest = $.ajax({
305            type: 'POST',
306            url: ajaxPostUrl,
307            data: content + '&action=wpmp_user_registration',
308            dataType: 'json',
309            success: function(data) {
310
311                $('#wpmp-reg-loader-info').hide();
312                //check mail sent status
313                if (data.mail_status == false) {
314
315                    $('#wpmp-mail-alert').show();
316                    $('#wpmp-mail-alert').html('Could not able to send the email notification.');
317                }
318                // check login status
319                if (true == data.reg_status) {
320                    $('#wpmp-register-alert').removeClass('alert-danger');
321                    $('#wpmp-register-alert').addClass('alert-success');
322                    $('#wpmp-register-alert').show();
323                    $('#wpmp-register-alert').html(data.success);
324
325                } else {
326                    $('#wpmp-register-alert').addClass('alert-danger');
327                    $('#wpmp-register-alert').show();
328                    $('#wpmp-register-alert').html(data.error);
329
330                }
331            },
332            error: function(data) {
333                console.log(data);
334            }
335        });
336    }
337
338    function wpmpShowResetPasswordForm() {
339        $('#btnForgotPassword').click(function() {
340              $('#wpmpResetPasswordSection').removeClass('hidden');
341              $('#wpmpLoginForm').slideUp(500);  
342               $('#wpmpResetPasswordSection').slideDown(500);
343        });
344    }
345    
346    function wpmpReturnToLoginForm() {
347        $('#btnReturnToLogin').click(function() {
348              $('#wpmpResetPasswordSection').slideUp(500);              
349              $('#wpmpResetPasswordSection').addClass('hidden');
350              $('#wpmpLoginForm').removeClass('hidden');
351              $('#wpmpLoginForm').slideDown(500);               
352        });
353    }
354
355    // Validate reset password form
356    //Neelkanth
357    function wpmpValidateAndProcessResetPasswordForm() {
358
359        $('#wpmpResetPasswordForm').formValidation({
360            message: 'This value is not valid',
361            icon: {
362                required: 'glyphicon glyphicon-asterisk',
363                valid: 'glyphicon glyphicon-ok',
364                invalid: 'glyphicon glyphicon-remove',
365                validating: 'glyphicon glyphicon-refresh'
366            },
367            fields: {
368                wpmp_rp_email: {
369                    validators: {
370                        notEmpty: {
371                            message: 'Please enter your email address which you used during registration.'
372                        },
373                        regexp: {
374                            regexp: '^[^@\\s]+@([^@\\s]+\\.)+[^@\\s]+$',
375                            message: 'The value is not a valid email address'
376                        }
377                    }
378                },
379                wpmp_newpassword: {
380                    validators: {
381                        notEmpty: {
382                            message: 'The password is required'
383                        },
384                        stringLength: {
385                            min: 6,
386                            message: 'The password must be more than 6 characters long'
387                        }
388                    }
389                }
390            }
391        }).on('success.form.fv', function(e) {
392            $('#wpmp-resetpassword-alert').hide();
393
394            $('body, html').animate({
395                scrollTop: 0
396            }, 'slow');
397            // You can get the form instance
398            var $resetPasswordForm = $(e.target);
399            // and the FormValidation instance
400            var fv = $resetPasswordForm.data('formValidation');
401            var content = $resetPasswordForm.serialize();
402            
403            // start processing
404            $('#wpmp-resetpassword-loader-info').show();
405            wpmpStartResetPasswordProcess(content);
406            // Prevent form submission
407            e.preventDefault();
408        });
409    }
410
411    // Make ajax request with email
412    //Neelkanth
413    function wpmpStartResetPasswordProcess(content) {
414        
415        var resetPasswordRequest = jQuery.ajax({
416            type: 'POST',
417            url: ajaxPostUrl,
418            data: content + '&action=wpmp_resetpassword',
419            dataType: 'json',
420            success: function(data) {
421                
422                $('#wpmp-resetpassword-loader-info').hide();
423                // check login status
424                if (data.success) {
425                    
426                    $('#wpmp-resetpassword-alert').removeClass('alert-danger');
427                    $('#wpmp-resetpassword-alert').addClass('alert-success');
428                    $('#wpmp-resetpassword-alert').show();
429                    $('#wpmp-resetpassword-alert').html(data.success);
430
431                } else {
432
433                    $('#wpmp-resetpassword-alert').show();
434                    $('#wpmp-resetpassword-alert').html(data.error);
435
436                }
437            },
438            error: function(data) {
439                console.log(data);
440            }
441        });
442    }
443
444
445
446})(jQuery);

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.