PageSourceSearch

https://static-cdn.whokeys.com/mall/js/27/findpassword.js?v20260922

js whokeys.com collected 2026-09-25 14:46:30 UTC 15,950 bytes, 473 lines download raw bytes

1$(function () {
2    $('#reset-account').on('blur', verifyResetAccount);
3    $('#reset-code').on('blur', verifyResetCode);
4    $('#reset-pwd').on('blur', verifyResetPwd);
5    $('#reset-confirm-pwd').on('blur', verifyResetConfirmPwd);
6    $('#reset-answer').on('blur', verifyResetAnswer);
7    $('#reset-check-account').on('click', checkEmailAccount);
8    $('#reset-getcode,#reset-getcode-again').on('click', getEmailAuthCode);
9    $('#reset-checkcode').on('click', checkEmailAuthCode);
10    $('#reset-check-security-question').on('click', checkSecurityQuestion);
11    $('#reset-submit').on('click', resetPassword);
12    $('#dirct-reset-pwd-submit').on('click',directResetPassword);
13
14    $('.tips').bind('click', function () {
15        $(this).css('display', 'none');
16    });
17
18    $('dl.select dd ul li').click(function () {
19        $('#ret-security_question_id').val($(this).data('value'));
20    });
21});
22
23function checkEmailAccount() {
24    var _this = $(this);
25    _this.siblings('.loader-inner').show();
26
27    if (verifyResetAccount()) {
28        var method = $('#reset-method').val();
29        var account = $('#reset-account').val();
30        account = $.trim(account);
31        var param = {account: account};
32
33        $.ajax({
34            url: '/authUser/checkAccount',
35            data: param,
36            type: 'GET',
37            dataType: 'jsonp',
38            jsonp: 'jsoncallback',
39            success: function (data) {
40                $('.loader-inner').hide();
41
42                if (data.code != 4001) {
43                    _this.parents('li').find('.tips').show().html(L('error_account_not_exist'));
44                    return false;
45                }
46
47                if (method == 'email') {
48                    $('.tip_anc').html(account);
49                    $('.forgot-password li.item:eq(0)').hide();
50                    $('.forgot-password li.item:eq(1),.forgot-password li.item:eq(2)').show();
51                    $('.maill_step li:eq(1)').addClass('active');
52                } else if (method == 'phone') {
53                    if (data.response.auth_phone) {
54                        $('#reset-account').val('+' + data.response.country_code + ' ' + data.response.auth_phone);
55                        $('.tip_anc').html('+' + data.response.country_code + ' ' + data.response.auth_phone);
56                        $('.forgot-password li.item:eq(0)').hide();
57                        $('.forgot-password li.item:eq(1),.forgot-password li.item:eq(2)').show();
58                        $('.maill_step li:eq(1)').addClass('active');
59                    } else {
60                        _this.parents('li').find('.tips').show().html('Unbound mobile phone, unable to retrieve it by this method!');
61                    }
62                } else if (method == 'question') {
63                    $('#reset-user_id').val(data.response.id);
64                    $('.forgot-password li.item:eq(0)').hide();
65                    $('.forgot-password li.item:eq(1)').show();
66                    $('.maill_step li:eq(1)').addClass('active');
67                }
68            }
69        });
70    }
71}
72
73var reset_lock = 0;
74function resetPassword() {
75    if (reset_lock > 0) return false;
76
77    var _this = $(this);
78    _this.siblings('.loader-inner').show();
79
80    if (verifyResetAccount() && verifyResetPwd() && verifyResetConfirmPwd()) {
81        reset_lock++;
82        var method = $('#reset-method').val();
83        var account = $('#reset-account').val();
84        account = $.trim(account);//First and last spaces
85        var code = $('#reset-code').val();
86        var password = $('#reset-pwd').val();
87        var token = $('#reset-submit').attr('token');
88        var param = {account: account, code: code, password: password, token: token, method: method};
89
90        $.ajax({
91            url: '/authUser/resetPassword',
92            data: param,
93            type: 'GET',
94            dataType: 'jsonp',
95            jsonp: 'jsoncallback',
96            success: function (data) {
97                $('#reset-submit').siblings('.loader-inner').hide();
98                if (data.code != 0) {
99                    _this.parents('li').find('.tips').show().html(data.msg);
100                    setTimeout(function () {
101                        reset_lock--;
102                    }, 3000);
103                    return false;
104                }
105
106                if (method == 'question') {
107                    $('.forgot-password li.item:eq(2),.forgot-password li.item:eq(3)').hide();
108                    $('.forgot-password li.item:eq(4)').show();
109                } else {
110                    $('.forgot-password li.item:eq(3),.forgot-password li.item:eq(4)').hide();
111                    $('.forgot-password li.item:eq(5)').show();
112                }
113                $('.maill_step li:eq(3)').addClass('active');
114
115                setTimeout(function () {
116                    window.location.href = data.loginUrl;
117                }, 2000);
118            },
119            error: function () {
120                reset_lock--;
121            }
122        });
123    }
124}
125
126function verifyResetAccount() {
127    var obj = $('#reset-account');
128    obj.parent().find('.tips').hide();
129    var account = obj.val();
130
131    if (verify.checkAccount(account) == false) {
132        obj.parent().find('.tips').show().html(verify.show_msg);
133        obj.parent().find('.loader-inner').hide();
134        return false;
135    }
136
137    return true;
138}
139
140function verifyResetCode() {
141    var obj = $('#reset-code');
142    obj.parent().find('.tips').hide();
143    var code = obj.val();
144    if (verify.checkCode(code) == false) {
145        obj.parent().find('.tips').show().html(verify.show_msg);
146        obj.parent().find('.loader-inner').hide();
147        return false;
148    }
149
150    return true;
151}
152
153function verifyResetPwd() {
154    var obj = $('#reset-pwd');
155    obj.parent().find('.tips').hide();
156    var newpwd = obj.val();
157    if (verify.checkPassword(newpwd) == false) {
158        obj.parent().find('.tips').show().html(verify.show_msg);
159        return false;
160    }
161
162    return true;
163}
164
165function verifyResetConfirmPwd() {
166    var obj = $('#reset-confirm-pwd');
167    obj.parent().find('.tips').hide();
168    var confirmpwd = obj.val();
169    if (verify.checkPassword(confirmpwd) == false) {
170        obj.parent().find('.tips').show().html(verify.show_msg);
171        $('.loader-inner').hide();
172        return false;
173    }
174
175    if ($('#reset-pwd').val() != confirmpwd) {
176        obj.parent().find('.tips').show().html(L('error_password_unmatched'));
177        $('.loader-inner').hide();
178        return false;
179    }
180
181    return true;
182}
183
184function verifyResetAnswer() {
185    var obj = $('#reset-answer');
186    obj.parent().find('.tips').hide();
187    var answer = obj.val();
188    if (!answer) {
189        obj.parent().find('.tips').show().html('Answer cannot be empty.');
190        $('.loader-inner').hide();
191        return false;
192    }
193
194    var question_id = $('#ret-security_question_id').val();
195    if (!question_id) {
196        obj.parent().find('.tips').show().html('Question cannot be empty.');
197        $('.loader-inner').hide();
198        return false;
199    }
200
201    return true;
202}
203
204var code_lock = 0;
205function getEmailAuthCode() {
206    if (code_lock > 0) return false;
207
208    var _this = $(this);
209
210    function openClock () {
211        _this.hide();
212        _this.siblings('.countdown').show();
213        var count = 120;
214        var _t = setInterval(function () {
215            if (count > 0) {
216                _this.siblings('.countdown').html(count + 's');
217            } else {
218                _this.siblings('.countdown').hide();
219                _this.siblings('.countdown').html('120s');
220                _this.show();
221                clearInterval(_t);
222            }
223            count--;
224        }, 1000);
225    }
226
227    if (verifyResetAccount()) {
228        code_lock++;
229        var account = $('#reset-account').val();
230        account = $.trim(account);
231        var param = null;
232        var url = '';
233
234        if (verify.isPhone(account)) {
235            param = {phone: account, type: 'findpwd'};
236            url = '/authUser/getPhoneAuthCode';
237            const trigger = window.triggerCaptchaInFindPwdByPhone({
238                phone: account,
239                type: 'findpwd',
240            }, (res) => {
241                setTimeout(function () {
242                    code_lock--;
243                }, 5000);
244                if (res.code !== 0) {
245                    _this.parents('li').find('.tips').show().html(res.msg);
246                }
247            }, (error) => {
248                _this.parents('li').find('.tips').show().html(error.msg);
249            }, (bizResult) => {
250                if (!bizResult) {
251                    code_lock--;
252                } else {
253                    openClock();
254                }
255            });
256            trigger && trigger();
257            return;
258        } else {
259            param = {account: account, type: 'findpwd'};
260            url = '/authUser/getEmailAuthCode';
261        }
262        openClock();
263
264        $.ajax({
265            url: url,
266            data: param,
267            type: 'GET',
268            dataType: 'jsonp',
269            jsonp: 'jsoncallback',
270            success: function (data) {
271                setTimeout(function () {
272                    code_lock--;
273                }, 5000);
274                if (data.code != 0) {
275                    _this.parents('li').find('.tips').show().html(data.msg);
276                }
277            },
278            error: function () {
279                code_lock--;
280            }
281        });
282    }
283}
284
285var chcek_code_lock = 0;
286function checkEmailAuthCode() {
287    if (chcek_code_lock > 0) return false;
288
289    var _this = $(this);
290    _this.siblings('.loader-inner').show();
291
292    if (verifyResetCode()) {
293        chcek_code_lock++;
294        code_lock++;
295        var account = $('#reset-account').val();
296        account = $.trim(account);
297        var code = $('#reset-code').val();
298        var param = {account: account, code: code};
299        $.ajax({
300            url: '/authUser/checkAccountAuthCode',
301            data: param,
302            type: 'GET',
303            dataType: 'jsonp',
304            jsonp: 'jsoncallback',
305            success: function (data) {
306                $('.loader-inner').hide();
307
308                setTimeout(function () {
309                    chcek_code_lock--;
310                    code_lock--;
311                }, 5000);
312
313                if (data.code != 0) {
314                    _this.parents('li').find('.tips').show().html(data.msg);
315                    return false;
316                }
317
318                $('#reset-submit').attr({token: data.token});
319                $('.forgot-password li.item:eq(1),.forgot-password li.item:eq(2)').hide();
320                $('.forgot-password li.item:eq(3),.forgot-password li.item:eq(4)').show();
321                $('.maill_step li:eq(2)').addClass('active');
322            },
323            error: function () {
324                chcek_code_lock--;
325                code_lock--;
326            }
327        });
328    }
329}
330
331var chcek_security_question_lock = 0;
332function checkSecurityQuestion() {
333    if (chcek_security_question_lock > 0) return false;
334
335    var _this = $(this);
336    _this.siblings('.loader-inner').show();
337
338    var account = $('#reset-account').val();
339    account = $.trim(account);
340    var user_id = $('#reset-user_id').val();
341    var question_id = $('#ret-security_question_id').val();
342    var answer = $('#reset-answer').val();
343    if (verifyResetAnswer()) {
344        chcek_security_question_lock++;
345        var param = {account: account, user_id: user_id, question_id: question_id, answer: answer};
346        $.ajax({
347            url: '/authUser/checkSecurityAnswer',
348            data: param,
349            type: 'GET',
350            dataType: 'jsonp',
351            jsonp: 'jsoncallback',
352            success: function (data) {
353                $('.loader-inner').hide();
354
355                setTimeout(function () {
356                    chcek_security_question_lock--;
357                }, 5000);
358
359                if (data.code != 0) {
360                    _this.parents('li').find('.tips').show().html(data.msg);
361                    return false;
362                }
363
364                $('.forgot-password li.item:eq(1)').hide();
365                $('.forgot-password li.item:eq(2),.forgot-password li.item:eq(3)').show();
366                $('.maill_step li:eq(2)').addClass('active');
367            },
368            error: function () {
369                chcek_security_question_lock--;
370            }
371        });
372    }
373}
374
375var direct_reset_lock = 0;
376function directResetPassword() {
377    if (direct_reset_lock > 0) return false;
378    if (verifyResetPwd() && verifyResetConfirmPwd()) {
379        $(this).siblings('.loader-inner').show();
380        direct_reset_lock ++;
381        var account = $("#dirct-reset-pwd-submit").data('account');
382        var password = $('#reset-pwd').val();
383        var param = {account:account,password:password};
384
385        $.ajax({
386            url: '/authUser/directResetPassword',
387            data: param,
388            type: "GET",
389            dataType: 'jsonp',
390            jsonp: "jsoncallback",
391            success: function (data) {
392                $(this).siblings('.loader-inner').hide();
393                if (data.code != 0) {
394                    $("#dirct-reset-pwd-submit").siblings('.tips').show().html(data.msg);
395                    setTimeout(function() {direct_reset_lock--;},3000)
396                    return false;
397                }
398                $(".forgot-password li:eq(1),.forgot-password li:eq(2),.forgot-password li:eq(3)").hide();
399                $(".forgot-password li:eq(4)").show();
400                setTimeout(function() {window.location.href = data.loginUrl;},2000);
401            },
402            error: function () {
403                direct_reset_lock--;
404            }
405        });
406    }
407}
408
409var verify = (function (my) {
410    var error_account_msg = []
411    error_account_msg[1] = L('error_account_null');
412    error_account_msg[2] = L('error_account_not_email');
413
414    my.show_msg = '';
415    my.checkAccount = function (str) {
416        if (str.length == 0) {
417            my.show_msg = error_account_msg[1];
418            return false;
419        }
420        if (!my.isEmail(str) && !my.isPhone(str)) {
421            my.show_msg = error_account_msg[2];
422            return false;
423        }
424        return true;
425    }
426
427    my.isEmail = function (str) {
428        var reg = /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/;
429        return reg.test(str);
430    }
431
432    my.isPhone = function (str) {
433        var reg = /^(\+\d{1,4} ?)?\d{3,12}$/;
434        return reg.test(str);
435    }
436
437    var error_password_msg = [];
438    error_password_msg[1] = L('error_password_null');
439    error_password_msg[2] = L('error_password_illegal');
440
441    my.checkPassword = function (pwd) {
442        if (pwd == '' || pwd == 'password') {
443            my.show_msg = error_password_msg[1];
444            return false;
445        }
446        if (pwd.length < 5 || pwd.length > 16) {
447            my.show_msg = error_password_msg[2];
448            return false;
449        }
450        return true;
451    }
452
453    var error_code_msg = []
454    error_code_msg[1] = L('error_auth_code_null');
455    error_code_msg[2] = L('error_auth_code_illegal');
456
457    my.checkCode = function (code) {
458        if (code == '') {
459            my.show_msg = error_code_msg[1];
460            return false;
461        }
462
463        var reg = /^\d{6}$/;
464        if (!reg.test(code)) {
465            my.show_msg = error_code_msg[2];
466            return false;
467        }
468
469        return true;
470    }
471
472    return my;
473})(verify || {})

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.