PageSourceSearch

https://jobs.echinacities.com/static/echina/js/logreg.js?86

js echinacities.com collected 2026-10-02 06:30:09 UTC 39,001 bytes, 890 lines download raw bytes

1var userRegister = {
2    parent: null, autocomplete_username: true, init: function (oParent, type) {
3        this.parent = oParent;
4        if (type == 'pre_login') {
5            this.pre_login();
6        } else if (type == 'second') {
7            this.second();
8        } else {
9            this.bind_register_user();
10        }
11        return this;
12    }, test_email: function (email) {
13        return /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[\w-]+$/.test(email);
14    }, test_username: function (username) {
15        return /^[\w\.\-_]{3,16}$/.test(username);
16    }, test_password: function (password) {
17        var xiaoxie = /[a-z]/;
18        var daxie = /[A-Z]/;
19        var other = /[^a-zA-Z0-9]/;
20        var shuzi = /[0-9]/
21        var fuzedu = 0;
22        if (xiaoxie.test(password)) {
23            fuzedu++;
24        }
25        if (daxie.test(password)) {
26            fuzedu++;
27        }
28        if (other.test(password)) {
29            fuzedu++;
30        }
31        if (shuzi.test(password)) {
32            fuzedu++;
33        }
34        var sizeok = password.length >= 8 && password.length <= 20;
35        var ht = [];
36        if (!sizeok) {
37            if (getLang() == "cn") {
38                ht.push("密码长度8-20个字符")
39            } else {
40                ht.push("Password length must be between 8 and 20 characters")
41            }
42        }
43        return {
44            source: fuzedu, ok: sizeok, htmls: ht,
45        }
46        // if (getLang() == "cn") {
47        //     if (fuzedu >= 3 && sizeok) {
48        //         ht.push("<ul class='password-tip'><li class='password-ok'><i class='fa fa-check'></i> 密码长度8-20个字符,需包含至少3种不同格式</li>")
49        //     } else {
50        //         ht.push("<ul class='password-tip'><li class='password-fail'><i class='fa fa-times'></i> 密码长度8-20个字符,需包含至少3种不同格式</li>")
51        //     }
52        //
53        //     if (daxie.test(password)) {
54        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> 大写字母</li>");
55        //     } else {
56        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> 大写字母</li>");
57        //     }
58        //
59        //     if (xiaoxie.test(password)) {
60        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> 小写字母</li>");
61        //     } else {
62        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> 小写字母</li>");
63        //     }
64        //     if (shuzi.test(password)) {
65        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> 数字</li>");
66        //     } else {
67        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> 数字</li>");
68        //     }
69        //     if (other.test(password)) {
70        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> 特殊字符(如@_%)</li></ul>");
71        //     } else {
72        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> 特殊字符(如@_%)</li></ul>");
73        //     }
74        // } else {
75        //     if (fuzedu >= 3 && sizeok) {
76        //         ht.push("<ul class='password-tip'><li class='password-ok'><i class='fa fa-check'></i> Password length must be between 8 and 20 characters Includes at lease 3 different character types</li>")
77        //     } else {
78        //         ht.push("<ul class='password-tip'><li class='password-fail'><i class='fa fa-times'></i> Password length must be between 8 and 20 characters Includes at lease 3 different character types</li>")
79        //     }
80        //
81        //     if (daxie.test(password)) {
82        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> Capital letters</li>");
83        //     } else {
84        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> Capital letters</li>");
85        //     }
86        //     if (xiaoxie.test(password)) {
87        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> Lowercase letters</li>");
88        //     } else {
89        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> Lowercase letters</li>");
90        //     }
91        //
92        //     if (shuzi.test(password)) {
93        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> Numbers</li>");
94        //     } else {
95        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i>
95 Numbers</li>");
96        //     }
97        //     if (other.test(password)) {
98        //         ht.push("<li class='password-ok'><i class='fa fa-check'></i> Special characters like $,_,%</li></ul>");
99        //     } else {
100        //         ht.push("<li class='password-fail'><i class='fa fa-times'></i> Special characters like $,_,%</li></ul>");
101        //     }
102        // }
103        //
104        // return {
105        //     source: fuzedu, ok: fuzedu >= 3 && sizeok, htmls: ht,
106        // }
107    }, show_error: function (obj, msg) {
108        $(obj).parents('.check_group').find('.color-red').html(msg);
109        // if (msg.length > 0) {
110        //     $(obj).css('border', '1px solid red');
111        // } else {
112        //     $(obj).css('border', '1px solid #ccc');
113        // }
114    }, check_user_email: function (ajaxCheck, checkall) {
115        var obj = $(this.parent).find('.check_user_email');
116        var val = $.trim(obj.val());
117        var result = false;
118        if (val.length == 0) {
119            if (checkall) this.show_error(obj, "This field is required");
120            result = false;
121        } else if (!this.test_email(val)) {
122            if (checkall) this.show_error(obj, "Please enter a valid email address");
123            result = false;
124        } else if (ajaxCheck) {
125            if (checkall) this.show_error(obj, "");
126            result = true;
127        } else {
128            var ths = this;
129            jPost('/api/v1/user/checkEmail', {email: val}, function (res) {
130                console.log("res", res)
131                if (res.code == 200) {
132                    if (res.data.exists) {
133                        ths.show_error(obj, 'This email has already been registered. If you have an existing eChinacities account, please try <a href="/login?type=' + getURL('type') + '"> logging in that account</a>');
134                    } else {
135                        ths.show_error(obj, "");
136                    }
137                }
138            })
139        }
140        if (checkall) {
141            this.check_all('email');
142        }
143        return result;
144    }, check_user_email_code: function (ajaxCheck, checkall) {
145        var obj = $(this.parent).find('.check_user_email_code');
146        var val = $.trim(obj.val());
147        var result = true;
148        if (val.length == 0) {
149            this.show_error(obj, "This field is required");
150            result = false;
151        } else {
152            this.show_error(obj, "");
153        }
154        if (checkall) {
155            // this.check_all('email');
156            userRegister.check_all();
157        }
158        return result;
159    }, check_user_username: function (ajaxCheck, checkall) {
160        var obj = $(this.parent).find('.check_user_username');
161        var val = $.trim(obj.val());
162        $('.repeat-name').hide();
163        var result = false;
164        if (val.length == 0) {
165            if (checkall) this.show_error(obj, "This field is required");
166            result = false;
167        } else if (!this.test_username(val)) {
168            if (checkall) this.show_error(obj, "(3 - 16 characters, no space; punctuation is not allowed except for periods, hyphens, and underscores.)");
169            result = false;
170        } else if (ajaxCheck) {
171            if (checkall) this.show_error(obj, "");
172            result = true;
173        } else {
174            var ths = this;
175            $.ajax({
176                async: false,
177                url: '/site/check_name1/' + encodeURIComponent(val),
178                dataType: 'json',
179                success: function (res) {
180                    if (res.code == 0) {
181                        ths.show_error(obj, "");
182                        result = true;
183                    } else {
184                        $('.repeat-name .recommend a').each(function (i, j) {
185                            $(j).text(res.items[i]);
186                        })
187                        $('.repeat-name').show();
188                        ths.show_error(obj, "");
189                        result = false;
190                    }
191                }
192            });
193        }
194        if (checkall) {
195            this.check_all('username');
196        }
197        return result;
198    }, check_user_password: function (checkall) {
199        var obj = $(this.parent).find('.check_user_password');
200        var val = $.trim(obj.val());
201        var result = false;
202        var checkResult = this.test_password(val);
203        if (val.length == 0) {
204            if (checkall) this.show_error(obj, "This field is required");
205            result = false;
206        } else if (!checkResult.ok) {
207            if (checkall) {
208                this.show_error(obj, checkResult.htmls.join(""));
209            }
210            result = false;
211        } else {
212            if (checkall) this.show_error(obj, '');
213            result = true;
214        }
215        if (checkall) {
216            this.check_all();
217        }
218        return result;
219    }, check_user_repassword: function (checkall) {
220        var old = $.trim($(this.parent).find('.check_user_password').val());
221        var obj = $(this.parent).find('.check_user_repassword');
222        var val = $.trim(obj.val());
223        var result = false;
224        if (val.length == 0) {
225            if (checkall) this.show_error(obj, "This field is required");
226            result = false;
227        } else if (old != val) {
228            if (checkall) this.show_error(obj, "Passwords do not match");
229            result = false;
230        } else {
231            if (checkall) this.show_error(obj, '');
232            result = true;
233        }
234        if (checkall) {
235            this.check_all();
236        }
237        return result;
238    }, check_user_scode: function (checkall) {
239        if ($('.register_scope').attr('data-hide') == 1 && getModel()) {
240            return true;
241        }
242        var obj = $(this.parent).find('.check_user_scode');
243        var val = $.trim(obj.val());
244        var result = false;
245        if (val.length == 0) {
246            if (checkall) this.show_error(obj, "Security code is required!");
247            result = false;
248        } else if (val.length < 4) {
249            if (checkall) this.show_error(obj, "Security code error!");
250            result = false;
251        } else {
252            if (checkall) this.show_error(obj, "");
253            result = true;
254        }
255        if (checkall) {
256            this.check_all();
257        }
258        return result;
259    }, check_user_agree: function (checkall) {
260        var result = !!$(this.parent).find('.check_user_agree:checked').length;
261        if (checkall) {
262            this.check_all();
263        }
264        return result;
265    }, check_all: function (not) {
266        var ths = this;
267        var end_result = ths.check_user_password(false) * ths.check_user_scode(false) * ths.check_user_agree(false);
268        if ($(this.parent).find('.check_user_repassword').length > 0) {
269            end_result *= ths.check_user_repassword(false);
270        }
271        if ($('.register_email_code:visible').length > 0) {
272            end_result *= ths.check_user_email_code(true, false);
273        }
274
275        if (not == 'email') {
276            end_result *= ths.check_user_email(false, false);
277        } else if (not == 'username') {
278            end_result *= ths.check_user_username(false, false);
279        }
280        if (end_result) {
281            $(this.parent).find('.btn-submit').attr('disabled', false).removeClass('disabled');
282        } else {
283            $(this.parent).find('.btn-submit').attr('disabled', true).addClass('disabled');
284        }
285        console.log('end_result:' + end_result);
286        return end_result;
287    }, register_user: function () {
288
289
290        var result = this.check_all();
291        if (result) {
292            try {
293                ga('send', 'event', 'registerpage', 'clickregisterbutton', 'clickregisterbuttonvalue');
294                if (getURL('type') == 0 || getURL('type') > 100) {
295
296                    if (location.href.split('answers.echinacities.').length == 2) {
297                        _hmt.push(['_setUserTag', '6203', '']);
298                    } else {
299                        _hmt.push(['_setUserTag', '6201', '']);
300                    }
301                } else if (getURL('type') > 0) {
302                    _hmt.push(['_setUserTag', '6202', '']);
303                } else {
304                    var s1 = location.host.split('.')[0]
305                    if (s1 == 'www') {
306                        _hmt.push(['_setUserTag', '897', '']);
307                    } else if (s1 == 'jobs') {
308                        _hmt.push(['_setUserTag', '6202', '']);
309                    } else {
310                        _hmt.push(['_setUserTag', '897', '']);
311                    }
312                }
313
314            } catch (e) {
315
316            }
317
318
319            $('.register1 .btn-submit').prop('disabled', true).find('.fa-pulse').css('display', 'inline-block');
320            $(this.parent).find('.loading').show();
321            var reg_location = 0;
322            if ($.trim($('.reg_location').val()) == 'job') {
323                reg_location = 1;
324            }
325            var invited_uid = $('.invited_uid').length == 0 ? 0 : $('.invited_uid').val();
326            var data = {
327                email: $.trim($(this.parent).find('.check_user_email').val()),
328                pw: $.trim($(this.parent).find('.check_user_password').val()),
329                eazy: 1,
330                subscribe: $(this.parent).find('.subscribe:checked').length > 0 ? 1 : 0,
331                username: $.trim($(this.parent).find('.check_user_username').val()),
332                reg_domain: reg_location,
333                invited_uid: invited_uid,
334                validateRequest: true,
335            };
336            if ($('.register_email_code:visible').length > 0) {
337                data['code'] = $.trim($('.check_user_email_code').val());
338            }
339            if ($('.register_scope:visible').length > 0) {
340                data['scode'] = $.trim($(this.parent).find('.check_user_scode').val());
341            }
342            var ths = this;
343            $.post('/site/ajax_register', data, function (res) {
344                $(ths.parent).find('.loading').hide();
345                switch (parseInt(res)) {
346                    case 11:
347                        ths.show_error($(ths.parent).find('.check_user_email_code'), "Verification code error");
348                        $('.register1 .btn-submit').prop('disabled', false).find('.fa-pulse').hide();
349                        break;
350                    case 10:
351                        $('.register_email_code').show();
352                        $('.register1 .btn-submit').prop('disabled', false).find('.fa-pulse').hide();
353                        break;
354                    case 8:
355                        userRegister.check_user_email(true, true)
356                        $('.register1 .btn-submit').prop('disabled', false).find('.fa-pulse').hide();
357                        break;
358                    case 9:
359                        $('.register1 .btn-submit').prop('disabled', false).find('.fa-pulse').hide();
360                        ths.show_error($(ths.parent).find('.check_user_scode'), "Security code error");
361                        break;
362                    case 2:
363                        userRegister.check_user_username(false, true);
364                        $('.register1 .btn-submit').prop('disabled', false).find('.fa-pulse').hide();
365                        break;
366                    case 0:
367                        var url = userRegister.get_next_url();
368                        $.ajax({async: false, url: '/site/ajax_no_compile'});
369                        if (url.length == 0) {
370                            ths.go_second();
371                            init_user();
372                        } else {
373                            location.href = url;
374                        }
375                        break;
376                    default:
377                        $('.register1 .btn-submit').prop('disabled', false).find('.fa-pulse').hide();
378                        break;
379                }
380            })
381        }
382    }, get_next_url: function () {
383        var url = '';
384        var reg_location = $.trim($('.reg_location').val());
385        var reg_location_url = $.trim($('.reg_location_url').val());
386        if ($('.reg_location_url').length > 0 && reg_location_url.length > 0) {
387            url = reg_location_url;
388        } else if ($('.reg_location').length > 0 && reg_location == 'job') {
389            url = "//jobs." + WEB_DOMAIN + "/job/resume/speedy_resume?first=1&fns=" + getURL('fns');
390        } else if (getURL('type') == 0 || getURL('type') == 101) {
391        } else {
392            url = "//jobs." + WEB_DOMAIN + "/job/resume/speedy_resume?first=1&fns=" + getURL('fns');
393        }
394        return url
395    }, sendLoginEmailCode: function () {
396        this.check_user_email(true, true);
397        var obj = $(this.parent).find('.check_user_email_code');
398        var email = $(this.parent).find('.check_user_email').val();
399        var ths = this;
400
401        jPost('/api/v1/user/sendRegisterEmail', {email: email, codeLen: 6}, function (res) {
402            console.log("res", res)
403            if (res.code == 200) {
404                var seconds = 180;
405                var cc1 = setInterval(function () {
406                    seconds = seconds - 1;
407                    if (seconds <= 0) {
408                        clearInterval(cc1);
409                        $('.phoneGetCode').text('Get Code');
410                    } else {
411                        $('.phoneGetCode').text(seconds + 's');
412                    }
413                }, 1000)
414            }
415        })
416
417    }, bind_register_user: function () {
418        var ths = this;
419        $(ths.parent).on('blur', '.check_user_email', function () {
420            ths.check_user_email(true, true);
421            if (ths.autocomplete_username == true) {
422                $(ths.parent).find('.check_user_username').val($('.check_user_email').val().substring(0, $('.check_user_email').val().indexOf('@')))
423            }
424
425        });
426
427        $(ths.parent).on('tap', '.phoneGetCode', function () {
428            ths.sendLoginEmailCode();
429            return false;
430        });
431
432        $(ths.parent).on('blur', '.check_user_email_code', function () {
433            ths.check_user_email_code(true, true);
434        });
435        $(ths.parent).on('keyup', '.check_user_email_code', function () {
436            ths.check_user_email_code(true, true);
437        });
438
439        $(ths.parent).on('blur', '.check_user_username', function () {
440            ths.check_user_username(true, true);
441        });
442
443        $(ths.parent).on('keyup', '.check_user_username', function () {
444            ths.autocomplete_username = false;
445        });
446        $(ths.parent).on('keyup', '.check_user_password', function () {
447            ths.check_user_password(true);
448        });
449        $(ths.parent).on('blur', '.check_user_password', function () {
450            ths.check_user_password(true);
451        });
452        $(ths.parent).on('keyup', '.check_user_repassword', function () {
453            ths.check_user_repassword(true);
454        });
455        $(ths.parent).on('blur', '.check_user_repassword', function () {
456            ths.check_user_repassword(true);
457        });
458        $(ths.parent).on('keyup', '.check_user_scode', function () {
459            ths.check_user_scode(true);
460        });
461        $(ths.parent).on('blur', '.check_user_scode', function () {
462            ths.check_user_scode(true);
463        });
464        $(ths.parent).on('click', '.check_user_agree', function () {
465            ths.check_user_agree(true);
466        });
467        $(ths.parent).on('click', '.recommend a', function () {
468            $(ths.parent).find('.check_user_username').val($(this).text());
469            ths.check_user_username(true);
470        });
471        $(ths.parent).on('click', '.btn-submit', function () {
472            ths.register_user();
473            // return false;
474        });
475        $(document).on('click', '.showPassword', function () {
476            var input = $('.showPassword').parents('.input-group').find('.check_user_password');
477            if (input.prop('type') == 'password') {
478                $(this).find('.glyphicon').removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open').css('color', '#00ae68');
479                input.prop('type', 'text');
480            } else {
481                $(this).find('.glyphicon').removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close').css('color', 'gray');
482                input.prop('type', 'password');
483            }
484            return false;
485        })
486    }, check_login_username: function () {
487        var obj = $(this.parent).find('.check_login_username');
488        var val = $.trim(obj.val());
489        this.show_error($(this.parent).find('.check_login_username'), "");
490        if (val.length == 0) {
491            this.show_error($(this.parent).find('.check_login_username'), "This field is required");
492            return false;
493        }
494        return true;
495    }, check_login_password: function () {
496        var obj = $(this.parent).find('.check_login_password');
497        var val = $.trim(obj.val());
498        this.show_error(obj, "");
499        if (val.length == 0) {
500            this.show_error(obj, "This field is required");
501            return false;
502        }
503        return true;
504    }, check_login_all: function () {
505        // var ths = this;
506        // var end_result = ths.check_login_username(false) * ths.check_login_password(false);
507        // if (end_result) {
508        //     $(this.parent).find('.btn-submit').attr('disabled', false);
509        // } else {
510        //     $(this.parent).find('.btn-submit').attr('disabled', true);
511        // }
512        // return end_result;
513    }, checkLoginEmail: function () {
514        var obj = $(this.parent).find('.check_login_password');
515        var val = $.trim($('input[name="email"]').val());
516        $('.forget_mail_error').text('');
517        if (val.length == 0) {
518            $('.forget_mail_error').text('This field is required')
519            return false;
520        }
521        if (!REG.email.test(val)) {
522            $('.forget_mail_error').text('This field is required')
523            return false;
524        }
525        return true;
526
527    }, pre_login_submit: function () {
528        var ths = this;
529        var per_to_url = $('#per_to_url').val();
530        var type = parseInt($('.js-login-chose-type .perLoginTit.active').attr('data-id'));
531        var ret = 1;
532        if (type == 0) {
533            ret *= ths.check_login_username() * ths.check_login_password()
534        } else {
535            ret *= ths.checkLoginEmail() * ths.checkLoginCode()
536        }
537        if (ret == 0) {
538            return;
539        }
540
541        var type = $('.nav-tabs li.active').index();
542        var postData = {
543            username: $.trim($(this.parent).find('.check_login_username').val()),
544            password: $.trim($(this.parent).find('.check_login_password').val()),
545            loginType: "username"
546        }
547        if (type == 1) {
548            postData = {
549                email: $.trim($(this.parent).find('.emailitems input[name="email"]').val()),
550                code: $.trim($(this.parent).find('.emailitems .forget_code').val()),
551                loginType: "emailCode"
552            }
553        }
554
555        jPost('/api/v1/user/login', postData, function (res) {
556            if (res.code == 200) {
557                $.get('/utils/loginByToken?user=1&token=' + res.data.token + '&rememberme=' + $(this.parent).find('.per_log_rememberme:checked').length, function (res) {
558                    if (res == 'success') {
559                        console.log("per_to_url", per_to_url)
560                        if (per_to_url) {
561                            try {
562                                eval(per_to_url + '()');
563                            } catch (exception) {
564                                window.location = per_to_url;
565                            }
566                        } else {
567                            window.location.reload();
568                        }
569                    }
570                });
571            } else if (res.reason == 'LOGIN_VERIFY_BAD') {
572                $('.check_login_password_error').text('Sorry, incorrect password.  Please try again.')
573            } else if (res.reason == 'USER_IS_DENY_SITE') {
574                $('#lockModal').modal('show')
575            } else if (res.data == 'CODE_ERROR') {
576                $('.emailitems .forget_code_error').html('Code error, please re-try.')
577            } else if (res.data == 'USER_NOT_FOUND') {
578                if (type == 0) {
579                    $('.check_login_username_error').text('The username you provided does not match any accounts on record. Please create a new account.')
580                } else {
581                    $('.emailitems .forget_mail_error').text("The email address you provided does not match any accounts on record. Please create a new account.");
582                }
583            }
584        })
585
586
587        // var per_log_username = $.trim($(this.parent).find('.check_login_username').val());
588        // var check_login_password = $.trim($(this.parent).find('.check_login_password').val());
589        // var per_log_rememberme = $(this.parent).find('.per_log_rememberme:checked').length;
590        // var per_to_url = $('#per_to_url').val();
591        //
592        // $.ajax({
593        //     type: "POST",
594        //     url: "/site/ajax_login",
595        //     data: {'username': per_log_username, 'pw': check_login_password, 'rememberme': per_log_rememberme},
596        //     success: function (re) {
597        //         re = parseInt(re);
598        //         switch (re) {
599        //             //个人用户已登录
600        //             case 0:
601        //                 $('#per_log').modal('hide');
602        //                 ths.show_error($(ths.parent).find('.check_login_password'), "");
603        //                 if (per_to_url) {
604        //                     try {
605        //                         eval(per_to_url + '()');
606        //                     } catch (exception) {
607        //                         window.location = per_to_url;
608        //                     }
609        //                 } else {
610        //                     window.location.reload();
611        //                 }
612        //                 break;
613        //             //禁整站
614        //             case 2:
615        //                 ths.show_error($(ths.parent).find('.check_login_password'), "Your account has been blocked due to posts containing spam, advertising or inappropriate content.");
616        //                 break;
617        //             //登录成功
618        //             case 6:
619        //                 $('#per_log').modal('hide');
620        //                 ths.show_error($(ths.parent).find('.check_login_password'), "");
621        //                 if (per_to_url) {
622        //                     try {
623        //                         eval(per_to_url + '()');
624        //                     } catch (exception) {
625        //                         window.location = per_to_url;
626        //                     }
627        //                 } else {
628        //                     window.location.reload();
629        //                 }
630        //                 break;
631        //             default:
632        //                 ths.show_error($(ths.parent).find('.check_login_password'), 'Sorry, invalid username or password. Please try again.');
633        //                 break;
634        //         }
635        //     }
636        // });
637    }, pre_login: function () {
638        var ths = this;
639        $(ths.parent).on('blur', '.check_login_username', function () {
640            ths.check_login_username(true);
641        });
642        $(ths.parent).on('keyup', '.check_login_username', function () {
643            ths.check_login_username(true);
644        });
645        $(ths.parent).on('blur', '.check_login_password', function () {
646            ths.check_login_password(true);
647        });
648        $(ths.parent).on('keyup', '.check_login_password', function () {
649            ths.check_login_password(true);
650        });
651        $(ths.parent).on('click', '.btn-submit', function () {
652            ths.pre_login_submit();
653            return false;
654        });
655
656        $(ths.parent).on('blur', '.emailitems input[name="email"]', function () {
657            ths.checkLoginEmail();
658        });
659
660
661        $(ths.parent).on('blur', '.emailitems .forget_code', function () {
662            ths.checkLoginCode();
663        });
664
665        $(ths.parent).on('click', '.send_email_btn', function () {
666            if (!ths.checkLoginEmail()) {
667                return;
668            }
669            jPost('/api/v1/user/sendLoginEmail', {
670                email: $.trim($('.emailitems input[name="email"]').val()),
671            }, function (res) {
672                if (res.code == 200) {
673                    var lock = 180;
674                    $('.send_email_btn').text('180s');
675                    $('.send_email_btn').prop('disabled', true);
676                    timer_update_email = setInterval(function () {
677                        $('.send_email_btn').text((lock--) + 's');
678                        if (lock <= 0) {
679                            clearInterval(timer_update_email);
680                            $('.send_email_btn').text('Obtain code');
681                            $('.send_email_btn').prop('disabled', false);
682                        }
683                    }, 1000)
684                } else if (res.reason == 'USER_IS_DENY_SITE') {
685                    $('#lockModal').modal('show')
686                } else if (res.data == 'USER_NOT_FOUND') {
687                    $('.forget_mail_error').text("The email address you provided does not match any accounts on record. Please create a new account.");
688                }
689
690            }, function () {
691                clearInterval(timer_update_email);
692                $('.send_email_btn').text('Obtain code');
693                $('.send_email_btn').prop('disabled', false);
694            })
695
696        })
697
698    }, checkLoginCode: function () {
699        var val = $.trim($('.emailitems .forget_code').val());
700        var obj = $(this.parent).find('.emailitems .forget_code');
701        this.show_error(obj, '');
702        if (val.length == 0) {
703            this.show_error(obj, 'Please enter security code');
704            return false;
705        }
706        return true;
707    }, check_user_country: function (checkall) {
708        $(this.parent).find('.register_other_country').val(cleanResumekeyword($(this.parent).find('.register_other_country').val()));
709        var obj = $(this.parent).find('.check_user_country');
710        var val = $.trim(obj.val());
711        var result = false;
712        if (val.length == '') {
713            if (checkall) this.show_error(obj, "This field is required");
714        } else if (val == '62') {
715            if (checkall) this.show_error(obj, "Required field");
716            if ($.trim($(this.parent).find('.register_other_country').val()) != '') {
717                this.show_error(obj, "");
718                result = true;
719            }
720        } else {
721            if (checkall) this.show_error(obj, "");
722            result = true;
723        }
724        if (checkall) {
725            this.check_scend_all();
726        }
727        return result;
728    }, check_user_location: function (checkall) {
729
730        $(this.parent).find('.register_user_location').val(cleanResumekeyword($(this.parent).find('.register_user_location').val()));
731        var obj = $(this.parent).find('.check_user_location');
732        var val = $.trim(obj.val());
733        var result = false;
734        if (val.length == '') {
735            if (checkall) this.show_error(obj, "This field is required");
736        } else if (val == '62') {
737            if (checkall) this.show_error(obj, "Required field");
738
739            if ($.trim($(this.parent).find('.register_user_location').val()) != '') {
740                this.show_error(obj, "");
741                result = true;
742            }
743        } else {
744            if (checkall) this.show_error(obj, "");
745            result = true;
746        }
747        if (checkall) {
748            this.check_scend_all();
749        }
750        return result;
751    }, check_user_location_city: function (checkall) {
752        var obj = $(this.parent).find('.check_user_location_city');
753        var val = $.trim(obj.val());
754        var result = false;
755        if (val.length == '') {
756            if (checkall) this.show_error(obj, "This field is required");
757        } else {
758            if (checkall) this.show_error(obj, "");
759            result = true;
760        }
761        if (checkall) {
762            this.check_scend_all();
763        }
764        return result;
765    }, check_scend_all: function () {
766        var ths = this;
767        var end_result = ths.check_user_country(false) * ths.check_user_location(false);
768        if ($(this.parent).find('.check_user_location').val() == 22) {
769            end_result = end_result * ths.check_user_location_city(false);
770        }
771        if (end_result == 1) {
772            $(this.parent).find('.btn-submit').attr('disabled', false);
773        } else {
774            $(this.parent).find('.btn-submit').attr('disabled', true);
775        }
776        return end_result;
777    }, submit_second: function () {
778        var check_scend_all = this.check_scend_all();
779        if (check_scend_all == 1) {
780            var data = {
781                'country': $(this.parent).find('.check_user_country').val(),
782                'location': $(this.parent).find('.check_user_location').val(),
783                'location_city': $(this.parent).find('.check_user_location_city').val(),
784                'country_other': $(this.parent).find('.register_other_country').val(),
785                'location_other': $(this.parent).find('.register_user_location').val(),
786            };
787            var ths = this;
788            $(ths.parent).find('.loading').show();
789            $(this.parent).find('.btn-submit').prop('disabled', true).find('.fa-pulse').css('display', 'inline-block');
790            $.post('/site/ajax_compile', data, function (r) {
791                $(ths.parent).find('.loading').hide();
792                var json = $.parseJSON(r);
793                if (json.code == 1) {
794                    location.href = "//jobs." + WEB_DOMAIN + "/job/resume/speedy_resume?first=1&fns=" + getURL('fns');
795                    // if ($(ths).parents('#per_reg').length == 1) {
796                    //     var per_to_url = $('#per_to_url').val();
797                    //     if (per_to_url) {
798                    //         location.href = per_to_url;
799                    //     } else {
800                    //         location.reload();
801                    //     }
802                    // } else {
803                    //     location.reload();
804                    //     // location.href = '//www.' + WEB_DOMAIN + '/site/register_success?t=' + Math.round(new Date() / 1000);
805                    // }
806                } else {
807                    $(ths.parent).find('.btn-submit').prop('disabled', false).find('.fa-pulse').hide();
808                }
809            });
810        }
811    }, second: function () {
812        var ths = this;
813        $(ths.parent).off('blur', '.check_user_country_handler');
814        $(ths.parent).off('blur', '.location_handler');
815        $(ths.parent).off('blur', '.location_city_handler');
816        $(ths.parent).off('tap', '.btn-submit');
817        $(ths.parent).on('blur', '.check_user_country_handler', function () {
818            ths.check_user_country(true);
819        });
820        $(ths.parent).on('blur', '.location_handler', function () {
821            ths.check_user_location(true);
822        });
823        $(ths.parent).on('blur', '.location_city_handler', function () {
824            ths.check_user_location_city(true);
825        });
826        $(ths.parent).on('tap', '.btn-submit', function () {
827            ths.submit_second();
828        });
829    }, go_second: function () {
830        $(window).scrollTop(0);
831        var ths = this;
832        var h1 = $('.register2').height();
833        var h2 = $('.register1').height();
834        $('.register2').css({'left': $('.register1').width(), 'display': 'block'});
835        // $('.register2').css({'height': Math.max(h1, h2)});
836        $('.register2').animate({left: 0});
837        userRegister.init($('.register2'), 'second');
838
839        $('.register1').animate({'height': h1});
840        setTimeout(function () {
841            $('.register1').hide();
842        }, 2000);
843
844        bindKeyUp('.register_other_country_parent', function () {
845            ths.check_user_country(true);
846        }, function () {
847            ths.check_user_country(true);
848        })
849
850        bindKeyUp('.register_user_location_parent', function () {
851            ths.check_user_location(true);
852        }, function () {
853            ths.check_user_location(true);
854        })
855
856        $('.Nationality_handler').select(function (id, val) {
857            $('.check_user_country').val(id);
858            if (id == '62') {
859                $('.register_other_country_parent').show();
860            } else {
861                $('.register_other_country_parent').hide();
862            }
863            ths.check_user_country(true);
864        });
865        $('.location_select_handler').select(function (id, val) {
866            $('.check_user_location').val(id);
867            if (id == '22') {
868                $('.location_city_handler').show();
869            } else {
870                $('.location_city_handler').hide();
871            }
872            if (id == '62') {
873                $('.register_user_location_parent').show();
874            } else {
875                $('.register_user_location_parent').hide();
876            }
877
878            ths.check_user_location(true);
879        });
880        $('.location_city_select_handler').select(function (id, val) {
881            $('.check_user_location_city').val(id);
882            ths.check_user_location_city(true);
883        });
884    }
885
886};
887
888
889// userRegister.go_second()
890

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.