PageSourceSearch

https://www.icruise.com/common_library/js/WMPHLogin.js

js icruise.com collected 2026-09-24 18:59:49 UTC 39,552 bytes, 1,236 lines download raw bytes

1
2$(document).ready(function() {
3GetSession();
4});
5
6// loading FB SDK because we don't have login functionality here , so we be able to sign out
7window.fbAsyncInit = function() {
8    FB.init({
9        appId      : '360984130621673', //FAcebook AppID
10        xfbml      : true,
11        cookie     : true,
12        version    : 'v2.6'
13    });
14};
15
16(function(d, s, id){
17    var js, fjs = d.getElementsByTagName(s)[0];
18    if (d.getElementById(id)) {return;}
19    js = d.createElement(s); js.id = id;
20    js.src = "//connect.facebook.net/en_US/sdk.js";
21    fjs.parentNode.insertBefore(js, fjs);
22    }(document, 'script', 'facebook-jssdk'));
23
24
25// loading auth because we don't have login functionality here, so we be able to sign out, it's in iFrame
26function onLoad() {
27    gapi.load('auth2', function() {
28        gapi.auth2.init();
29    });
30}
31
32
33function GetSession(){
34    //alert('in GET Session');
35    var currentdate = new Date();
36    var WMPHSetUsername = "";
37    var datetime =  currentdate.getDate() + "/"
38    + (currentdate.getMonth()+1)  + "/"
39    + currentdate.getFullYear() + " "
40    + currentdate.getHours() + ":"
41    + currentdate.getMinutes() + ":"
42    + currentdate.getSeconds();
43
44    $.post("/../../../c/p/AjaxGetSession.php",{
45        'ms=' : datetime
46        },function(data){
47            var loggedin=data.WMPHLoginValid;
48            var UserName=data.WMPHLoginUsername;
49            var WMPHFirstName=data.WMPHFirstName;
50            var WMPHNickName=data.WMPHNickName;
51            var WMPHLoginUserID=data.WMPHLoginUserID;
52
53            //console.log('loggedin=*'+loggedin+'*');
54            //console.log('UserName=*'+UserName+'*');
55            //console.log('WMPHFirstName=*'+WMPHFirstName+'*');
56
57            if(loggedin.trim()=='1'){
58                //alert('YESS');
59
60                $("#loginLI").hide();
61                $(".UserLogedInUserNameLI").show();
62                //$(".signinHeaderLink").attr("href","/c/p/Profile.php");
63                $(".signinHeaderLink").removeAttr("data-toggle");
64                $(".signinHeaderLink").removeClass("bootstrapContainerLogin");
65
66                if($(".msigninHeaderLink").length){
67                    $(".msigninHeaderLink").attr("href","/cm/myaccount.php");
68                    $(".mProfileUrl").attr("href","/cm/myaccount.php");
69                }
70
71                if(WMPHNickName!=''){
72                    WMPHSetUsername = WMPHNickName;
73                    $(".UserLogedInUserNameLI a").html("My Account");
74                }else if(WMPHFirstName!=''){
75                    WMPHSetUsername = WMPHFirstName;
76                    $(".UserLogedInUserNameLI a").html("My Account");
77                }else{
78                    WMPHSetUsername = "My Account";
79                    $(".UserLogedInUserNameLI a").html("My Account");
80                }
81                $(".UserLogedInUserName").html(WMPHSetUsername);
82                $("#logoutLI").show();
83
84                /*** Login/Logout ID for mobile menu ***/
85                if($("#mloginLI"). length){
86                    $("#mloginLI" , window.parent.document).hide();
87                    $("#mlogoutLI" , window.parent.document).css("display","block");
88                    $("#mMyAccountLI" , window.parent.document).css("display","block");
89                }
90            }else{
91                //alert('NOOOO');
92                $(".UserLogedInUserNameLI").hide();
93                $(".UserLogedInUserName").html("Sign In | Register");
94            }
95        },"json");
96}
97
98
99
100function getUserInfo(Email, Pass, WUID){
101
102    if(Email=='' || Email == undefined){Email='';}
103    if(Pass=='' || Pass == undefined){Pass='';}
104    if(WUID=='' || WUID == undefined){WUID='';}
105
106
107    var currentdate = new Date();
108    var WMPHSetUsername = "";
109    var datetime =  currentdate.getDate() + "/"
110    + (currentdate.getMonth()+1)  + "/"
111    + currentdate.getFullYear() + " "
112    + currentdate.getHours() + ":"
113    + currentdate.getMinutes() + ":"
114    + currentdate.getSeconds();
115
116    $.post("/../../../c/p/ajaxGetUserInfo.php",{
117        'ms=' : datetime
118        ,'Email':Email
119        ,'Pass':Pass
120        ,'WUID':WUID
121        },function(data){
122            console.log('in getUserInfo');
123            return data;
124        },"json");
125}
126
127
128
129function signOut() {
130    logOutFromFacebook();
131
132    setTimeout(function() {
133        logOutFromGoogle();
134        }, 500);
135}
136
137function logOutFromFacebook(){
138    //Facebook logout
139    FB.getLoginStatus(function(response) {
140        if (response && response.status === 'connected') {
141            FB.logout(function(response) {
142                //document.location.reload();
143                console.log('User signed out from Facebook.');
144            });
145        }
146    });
147}
148
149
150function logOutFromGoogle(){
151    //Google logout
152    var auth2 = gapi.auth2.getAuthInstance();
153    auth2.signOut().then(function () {
154        console.log('User signed out from Google.');
155    });
156}
157
158
159function LogOutFromWMPH(URL){
160
161    var currentdate = new Date();
162    var datetime =  currentdate.getDate() + "/"
163    + (currentdate.getMonth()+1)  + "/"
164    + currentdate.getFullYear() + " "
165    + currentdate.getHours() + ":"
166    + currentdate.getMinutes() + ":"
167    + currentdate.getSeconds();
168    //alert("**** LogOutFromWMPH= "+URL);
169
170    setTimeout(     //just to make sure logout from Facebook and google done completely
171        function()
172        {
173
174            $.ajax({
175                url: '/../../../c/p/ajaxLogOutFromWMPH.php',
176                type: 'POST',
177                data: 'ms=' + datetime,
178                success: function(data){
179
180                    //alert("ok logged out");
181
182                    $("#loginLI").show();
183                    //$("#SignUpLI").show();
184                    //$("#UserLogedInUserNameLI").html(''); Bug#6088 Comment#4
185                    $("#FavCountSpan").html('');
186                    $("#FavCountSpanTopMenu").html('');
187                    $(".FavCountSpanNonIndex").html('');
188                    $("#FavCountSpanTopMenu").html('');
189                    //$("#UserLogedInUserNameLI").hide();             Bug#6088 Comment#4
190                    $("#logoutLI").hide();
191                    $(".UserLogedInUserNameLI").hide();
192                    $(".signinHeaderLink").attr("href","#bootstrapContainerLogin");
193
194                    /*$(".dropdown a.defaultProfileLink").hide();
195                    $(".dropdown .bootstrapContainerLogin").show();*/
196
197                    if(URL.trim()!='' && URL!=undefined){
198                        console.log('log out URL='+URL);
199                        //window.top.location.href = URL;
200                        window.location.replace(URL);
201
202                    }else{
203                        //console.log('log out URL='+ '//icruise.com');
204                        window.location.replace("https://www.icruise.com");
205                    }
206
207                },
208                error: function (request, status, error) {
209                    alert(request.responseText);
210                }
211
212            });
213
214        }, 500);
215
216}
217
218
219
220function SuccessLogIn(DisplayName, RedirectTo){
221    if(RedirectTo=='' || RedirectTo==undefined){ RedirectTo= window.location.pathname;}
222
223    if(RedirectTo =='/cm/lgn.php'){RedirectTo= ''; } //bugz#: 12437
224
225    if(RedirectTo!='No'){// don't redirect
226        /** Redirect for mbile site **/
227        var m_path = window.location;
228        var m_path2 = m_path.host;
229
230
231
232        /*if(m_path2.indexOf("m.") > 0 && RedirectTo ==''){
233            var mRedirectTo = m_path.protocol + "//" + m_path.host + "/" + m_path.pathname.split('/')[0];
234            RedirectTo = mRedirectTo;
235        }*/
236
237        /*** UPDATE TO REDIRECT MOBILE TO PREVIOUS PAGE ***/
238        if(m_path2.indexOf("m.") >= 0 ){
239            var m_redirectPath = "";
240            var getSubstr = window.location.search.substring(1);
241            var getParam = getSubstr.split('&');
242            for (var i = 0; i < getParam.length; i++){
243                var getParamName = getParam[i].split('=');
244
245                if (getParamName[0] == "returnUrl"){
246                    m_redirectPath = getParamName[1];
247                }else{
248                    m_redirectPath = m_path.protocol + "//" + m_path.host + "/" + m_path.pathname.split('/')[0];
249                }
250            }
251            RedirectTo = m_redirectPath;
252        }
253        /*** /UPDATE TO REDIRECT MOBILE TO PREVIOUS PAGE ***/
254
255        /** Redirect for mbile site **/
256    }
257
258    $("#WrongCredential").hide();
259    // login was successful and move forward.
260    //alert(Email);
261
262    //$("#UserLogedInUserNameLI" , window.parent.document).html('<a href="#" >Hi, '+DisplayName+'</a>'); Bug#6088 Comment#4
263
264    if(DisplayName!=''){
265        $(".UserLogedInUserName").html(DisplayName);
266        $(".UserLogedInUserNameLI a").html("My Account");
267        $("a.defaultProfileLink .UserLogedInUserName").html(DisplayName);
268    }else{
269        $(".UserLogedInUserName").html("My Account");
270        $(".UserLogedInUserNameLI a").html("My Account");
271        $("a.defaultProfileLink .UserLogedInUserName").html("My Account");
272    }
273    $(".UserLogedInUserNameLI").show();
274    $(".UserLogedInUserName").show();
275
276
277    $("#loginLI" , window.parent.document).hide();
278    //$("#SignUpLI" , window.parent.document).hide();
279    $("#logoutLI" , window.parent.document).show();
280    //$("#UserLogedInUserNameLI" , window.parent.document).show();Bug#6088 Comment#4
281
282    /*** Login/Logout ID for mobile menu ***/
283    if($("#mloginLI"). length){
284        $("#mloginLI" , window.parent.document).hide();
285        $("#mlogoutLI" , window.parent.document).show();
286        $("#mMyAccountLI" , window.parent.document).show();
287    }
288
289    $("#exposeMask", window.parent.document).trigger("click"); // to close the overlay
290    console.log('SuccessLogIn => redirect to '+RedirectTo);
291
292
293    RedirectPage(RedirectTo);
294}
295
296function RedirectPage(RedirectTo){
297
298    if(RedirectTo=='' || RedirectTo==undefined){ RedirectTo='';}
299    console.log('RedirectPage => redirect to '+RedirectTo);
300
301    //    console.log('In RedirectPage...');
302    //    console.log(window.parent.location.href);
303    //    console.log(window.location.href);
304    //    console.log('SSSS');
305
306    var currentdate = new Date();
307    var datetime =  currentdate.getDate() + "/"
308    + (currentdate.getMonth()+1)  + "/"
309    + currentdate.getFullYear() + " "
310    + currentdate.getHours() + ":"
311    + currentdate.getMinutes() + ":"
312    + currentdate.getSeconds();
313
314    $.post("/../../c/p/AjaxGetSession.php",{
315        'ms=' : datetime
316        },function(data){
317
318            //console.log(JSON.stringify(data));
319
320            var WMPHLoginRedirectURL = data.WMPHLoginRedirectURL;
321            if(RedirectTo !='' && RedirectTo!='No'){// don't redirect){
322                WMPHLoginRedirectURL = RedirectTo;
323            }
324
325            var FavCount = data.FavCount;
326
327            if(FavCount>0){
328                $('#FavCountSpan').html(" ( " + FavCount+" ) ");
329                $('#FavCountSpanTopMenu').html(" ( " + FavCount+" ) ");
330            }
331
332            console.log('WMPHLoginRedirectURLXX='+WMPHLoginRedirectURL);
333            //alert('ss');
334            if(WMPHLoginRedirectURL.trim()!=''){
335                console.log('WMPHLoginRedirectURL= '+WMPHLoginRedirectURL);
336                //alert('ok');
337                window.parent.location.href = WMPHLoginRedirectURL;
338            }else{
339                //alert('NOOOO');
340                console.log('Close the login popup');
341                $('.close').trigger( "click" );
342            }
343        },"json");
344
345
346}
347
348
349function Login(Email,Pass,RedirectTo){
350
351    if(Pass=='' || Pass==undefined){ Pass='';}
352    if(RedirectTo=='' || RedirectTo==undefined){ RedirectTo='';}
353
354    if(Email=='' || Email==undefined){ return false;}
355
356    var currentdate = new Date();
357    var datetime =  currentdate.getDate() + "/"
358    + (currentdate.getMonth()+1)  + "/"
359    + currentdate.getFullYear() + " "
360    + currentdate.getHours() + ":"
361    + currentdate.getMinutes() + ":"
362    + currentdate.getSeconds();
363    $(".sign-in-button").addClass("loading-button loading-button-resize");
364    let tealium_event = $("#tealium_event").val();
365
366    let tealium_utag = new Object();
367    tealium_utag.email = Email;
368    tealium_utag.tealium_event = tealium_event;
369
370    $.ajax({
371        url: '/../../../c/p/ajaxLgn.php',
372        type: 'POST',
373        data: 'Email='+encodeURIComponent(Email)+'&Pass=' + Pass+'&ms=' + datetime,
374        success: function(data){
375            utag_tealium(tealium_utag);
376            if(data.trim()=='error'){
377                console.log('Login-> Error log in ...');
378                $("#WrongCredential").show();
379                $('#frame1').contents().find("#WrongCredential").show();
380
381                $(".mobile-signin-signup").html("test");
382                $("#WrongCredential", parent.document.body).show();
383                $("#email").focus();
384
385                $("#loginLI" , window.parent.document).show(); // this is in manage include (header)
386                //$("#SignUpLI" , window.parent.document).hide();
387                $("#logoutLI" , window.parent.document).hide();
388                //$("#UserLogedInUserNameLI" , window.parent.document).html(''); Bug#6088 Comment#4
389                //$("#UserLogedInUserNameLI" , window.parent.document).hide(); Bug#6088 Comment#4
390                return false;
391            }else{
392                // login was successful and move forward.
393                //alert(Email);
394                console.log('Success log in ...');
395                SuccessLogIn(data,RedirectTo); // This Function located in /common_library/js/WMPHLogin.js
396            }
397        },
398        error: function (request, status, error) {
399            alert(request.responseText);
400        }
401
402    });
403}
404
405
406function LoginWithWUID(WUID,Pass,RedirectTo){
407    console.log('LoginWithWUID => redirect to '+RedirectTo);
408    if(Pass=='' || Pass==undefined){ Pass='';}
409    if(RedirectTo=='' || RedirectTo==undefined){ RedirectTo='';}
410
411    if(WUID=='' || WUID == undefined){
412        console.log("WUID can't be empty!");
413        return false;
414    }
415
416    var currentdate = new Date();
417    var datetime =  currentdate.getDate() + "/"
418    + (currentdate.getMonth()+1)  + "/"
419    + currentdate.getFullYear() + " "
420    + currentdate.getHours() + ":"
421    + currentdate.getMinutes() + ":"
422    + currentdate.getSeconds();
423
424    if(CheckSignInPassForLoginWithWUID()){
425
426        $(".sign-in-button").addClass("loading-button loading-button-resize");
427        $.ajax({
428            url: '/../../../c/p/ajaxLgn.php',
429            type: 'POST',
430            data: 'WUID='+WUID+'&Pass=' + Pass+'&ms=' + datetime,
431            success: function(data){
432
433                if(data.trim()=='error'){
434                    console.log('LoginWithWUID-> Error log in ...');
435                    $(".sign-in-button").removeClass("loading-button loading-button-resize");
436                    $("#WrongCredential").show();
437                    $(".mobile-signin-signup").html("test");
438                    $("#WrongCredential", parent.document.body).show();
439                    $("#email").focus();
440
441                    $("#loginLI" , window.parent.document).show(); // this is in manage include (header)
442                    //$("#SignUpLI" , window.parent.document).hide();
443                    $("#logoutLI" , window.parent.document).hide();
444                    //$("#UserLogedInUserNameLI" , window.parent.document).html(''); Bug#6088 Comment#4
445                    //$("#UserLogedInUserNameLI" , window.parent.document).hide(); Bug#6088 Comment#4
446                    return false;
447                }else{
448                    // login was successful and move forward.
449                    //alert(Email);
450                    docLoadingDesktopOverlay('','Loading...');
451                    console.log('Success log in ...');
452                    SuccessLogIn(data,RedirectTo); // This Function located in /common_library/js/WMPHLogin.js
453
454                }
455            },
456            error: function (request, status, error) {
457                alert(request.responseText);
458            }
459        });
460    }else{
461        console.log('LoginWithWUID-> Error log in ...');
462        $(".sign-in-button").removeClass("loading-button loading-button-resize");
463
464        $(".mobile-signin-signup").html("test");
465        $("#email").focus();
466
467        $("#loginLI" , window.parent.document).show(); // this is in manage include (header)
468        //$("#SignUpLI" , window.parent.document).hide();
469        $("#logoutLI" , window.parent.document).hide();
470        //$("#UserLogedInUserNameLI" , window.parent.document).html(''); Bug#6088 Comment#4
471        //$("#UserLogedInUserNameLI" , window.parent.document).hide(); Bug#6088 Comment#4
472
473        return false;
474    }
475}
476
477
478function validateEmail(Email) {
479    /*var re = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
480
481    if (re.test(Email)) {
482    return true;
483    }else {
484    return false;
485    }*/
486
487    var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
488    return pattern.test(Email);
489}
490
491
492
493
494
495
496function signIntoWmph(){
497
498    var currentdate = new Date();
499    var datetime =  currentdate.getDate() + "/"
500    + (currentdate.getMonth()+1)  + "/"
501    + currentdate.getFullYear() + " "
502    + currentdate.getHours() + ":"
503    + currentdate.getMinutes() + ":"
504    + currentdate.getSeconds();
505
506    $(".bootmodal_lgnpass .modal-body").html('');
507
508    $.ajax({
509        url: '/../../../c/p/lgn.php',
510        type: 'POST',
511        data: 'ms=' + datetime,
512        success: function(data){
513
514            $(".bootmodal_lgnpass .modal-body").html(data);
515
516        }
517
518    });
519}
520
521
522
523function forgotPassForWmphLogin(Email){
524
525    if(Email == '' || Email== undefined){
526        Email = '';
527    }
528
529    console.log('in forgotPassForWmphLogin=>'+Email);
530
531    var currentdate = new Date();
532    var datetime =  currentdate.getDate() + "/"
533    + (currentdate.getMonth()+1)  + "/"
534    + currentdate.getFullYear() + " "
535    + currentdate.getHours() + ":"
536    + currentdate.getMinutes() + ":"
537    + currentdate.getSeconds();
538
539    $(".bootmodal_lgnpass .modal-body").html('');
540
541    $.ajax({
542        url: '/../../../c/p/forgpass.php',
543        type: 'POST',
544        data: {'Email':Email, 'ms': datetime},
545        success: function(data){
546
547            $(".bootmodal_lgnpass .modal-body").html(data);
548
549        }
550
551    });
552}
553
554
555function ResetPassword(){
556
557    var currentdate = new Date();
558    var datetime =  currentdate.getDate() + "/"
559    + (currentdate.getMonth()+1)  + "/"
560    + currentdate.getFullYear() + " "
561    + currentdate.getHours() + ":"
562    + currentdate.getMinutes() + ":"
563    + currentdate.getSeconds();
564
565    $(".bootmodal_lgnpass .modal-body").html('');
566
567    $.ajax({
568        url: '/../../../c/p/ResPass.php',
569        type: 'POST',
570        data: 'ms=' + datetime,
571        success: function(data){
572
573            $(".bootmodal_lgnpass .modal-body").html(data);
574
575        }
576
577    });
578}
579
580function CheckForgotPassForm(){
581    var Email=$("#ForgotPassEmail").val();
582    $("#EnterValidEmail").hide();
583    $("#WrongEmail").hide();
584
585    if(!validateEmail(Email)){  // This Function located in /common_library/js/WMPHLogin.js
586        $("#EnterValidEmail").show();
587        return false;
588    }else{
589        CheckForgetPassCredential();
590    }
591}
592
593
594function CheckForgetPassCredential(Email){
595    if(Email == '' || Email == undefined){
596        Email= $("#ForgotPassEmail").val()
597    }
598    $("#ResetConfirm").hide();
599
600
601    var currentdate = new Date();
602    var datetime =  currentdate.getDate() + "/"
603    + (currentdate.getMonth()+1)  + "/"
604    + currentdate.getFullYear() + " "
605    + currentdate.getHours() + ":"
606    + currentdate.getMinutes() + ":"
607    + currentdate.getSeconds();
608    $(".sign-in-button").addClass("loading-button loading-button-resize");
609
610    $.ajax({
611        url: '/../../../c/p/ajaxForgPass.php',
612        type: 'POST',
613        data: 'Email='+ encodeURIComponent(Email)+'&ms=' + datetime,
614        cache: false,
615        success: function(data){
616
617            //alert(data);
618
619            if(data.trim()=='error'){
620                $("#WrongEmail").show();
621                $(".sign-in-button").removeClass("loading-button");
622                return false;
623            }else{
624                $("#WrongEmail").hide();
625                $("#EmailReset").text(Email);
626                $("#ForgotPassDiv").hide();
627                $("#ResetConfirm").show();
628                // found email and sent restore email.
629                //alert('Please check your email to restore your password.');
630            }
631        },
632        error: function (request, status, error) {
633            alert(request.responseText);
634            alert(status.responseText);
635            alert(error.responseText);
636        }
637    });
638}
639
640
641function CheckLoginCredential(){
642
643    $("#WrongCredential").css("display", "none");
644
645    var Email= $("#email").val();
646    var Pass= $("#password").val();
647
648    if(!validateEmail(Email)){  // This Function located in /common_library/js/WMPHLogin.js
649        $("#EnterValidEmail").show();
650        return false;
651    }else{
652        $("#EnterValidEmail").hide();
653    }
654
655    if(Email==''){
656        $("#WrongCredential").show();
657        return false;
658    }
659
660    if(Pass==''){
661        $("#WrongCredential").show();
662        return false;
663    }
664    var CurrentURL= window.location.pathname;
665    Login(Email,Pass, CurrentURL); // This Function located in /common_library/js/WMPHLogin.js
666}
667
668
669
670
671function SignUpForWmphLogin(){
672
673    var currentdate = new Date();
674    var datetime =  currentdate.getDate() + "/"
675    + (currentdate.getMonth()+1)  + "/"
676    + currentdate.getFullYear() + " "
677    + currentdate.getHours() + ":"
678    + currentdate.getMinutes() + ":"
679    + currentdate.getSeconds();
680
681    var refUrl = window.location.search.substring(1);
682    var refUrl = refUrl.split('=');
683    var param = 'ms=' + datetime + '&ajaxURL=' + refUrl[1];
684
685    $(".bootmodal_lgnpass .modal-body").html('');
686
687    $.ajax({
688        url: '/../../../c/p/sup.php',
689        type: 'POST',
690        /*data: 'ms=' + datetime,*/
691        data: param,
692        success: function(data){
693
694            $(".bootmodal_lgnpass .modal-body").html(data);
695
696        }
697
698    });
699}
700
701function CheckSignUpForm(){
702
703    var Email=$("#EmailSignUp").val();
704    var FirstName=$("#FirstName").val();
705    var LastName=$("#LastName").val();
706    var tealium_event=$("#tealium_event").val();
707
708    //$("#EnterValidEmail").hide();
709    $("#UserNameIsAvailable").hide();
710    $("#UserNameIsNOTAvailable").hide();
711
712    $("#PassRestriction").hide();
713    $("#PassRestrictionGood").hide();
714
715    $("#PassDontMatch").hide();
716    $("#PassMatch").hide();
717
718    let tealium_utag = new Object();
719    tealium_utag.email = Email;
720    tealium_utag.firstname = FirstName;
721    tealium_utag.lastname = LastName;
722    tealium_utag.tealium_event = tealium_event;
723
724    if(!validateEmail(Email)){ // This Function located in /common_library/js/WMPHLogin.js
725        $("#EnterValidEmail").show();
726        return false;
727    }else{
728
729        if(CompareSignUpPass()){
730            //console.log('ComparePass() == true');
731            if(CheckTblForEmailSignUp('yes')){
732                //console.log('CheckTblForEmail() == true');
733                utag_tealium(tealium_utag);
734            }else{
735                //console.log('CheckTblForEmail() == false');
736            }
737        }else{
738            //console.log('ComparePass() == false');
739        }
740
741    }
742}
743
744
745    function postSignUpData(){
746
747    var currentdate = new Date();
748    var datetime =  currentdate.getDate() + "/"
749    + (currentdate.getMonth()+1)  + "/"
750    + currentdate.getFullYear() + " "
751    + currentdate.getHours() + ":"
752    + currentdate.getMinutes() + ":"
753    + currentdate.getSeconds();
754
755    var Pass= encodeURIComponent($("#pass").val());     // to make sure we are not stripping out some stuff like plus sign (+)
756    var rePass= encodeURIComponent($("#rePass").val()); // to make sure we are not stripping out some stuff like plus sign (+)
757    var Email= encodeURIComponent( $("#EmailSignUp").val());  // to make sure we are not stripping out some stuff like plus sign (+)
758
759    var FirstName = encodeURIComponent($("#FirstName").val());
760    var LastName = encodeURIComponent($("#LastName").val());
761    var tealium_event = $('#tealium_event').val();
762
763    let tealium_utag = new Object();
764    tealium_utag.firstname = FirstName;
765    tealium_utag.lastname = LastName;
766    tealium_utag.email = Email;
767    tealium_utag.tealium_event = tealium_event;
768
769    //alert('Email='+Email+'&Pass=' + Pass+'&rePass=' + rePass+'&ms=' + datetime);
770
771    $("#forms_box").hide();
772    $("#CheckEmailDiv").hide();
773    $("#loadingGIF").show();
774
775    $.ajax({
776        url: '/../../../c/p/ajaxSupUser.php',
777        type: 'POST',
778        data: "FirstName="+FirstName+"&LastName="+LastName+"&Email="+Email+"&Pass=" + Pass+"&rePass=" + rePass+"&ms=" + datetime,
779        cache: false,
780        async: true,
781        success: function(data){
782            //console.log('postData->data= '+data);
783            //alert(data);
784            $("#CheckEmailDiv").show();
785            $("#CheckEmailDivEmail").val(Email);
786            $("#CheckEmailDivPass").val(Pass);
787            $("#forms_box").hide();
788            $("#loadingGIF").hide();
789            $("#loginLI").hide();
790            $("#logoutLI").show();
791            utag_tealium(tealium_utag);
792        }
793    });
794}
795
796
797function CheckTblForEmailSignUp(CallPostDataFunction){
798
799    if(CallPostDataFunction=='' || CallPostDataFunction==undefined){CallPostDataFunction='no';}
800
801    Email=$('#EmailSignUp').val();
802
803    var currentdate = new Date();
804    var datetime =  currentdate.getDate() + "/"
805    + (currentdate.getMonth()+1)  + "/"
806    + currentdate.getFullYear() + " "
807    + currentdate.getHours() + ":"
808    + currentdate.getMinutes() + ":"
809    + currentdate.getSeconds();
810
811    $("#EnterValidEmail").hide();
812    $("#UserNameIsAvailable").hide();
813    $("#UserNameIsNOTAvailable").hide();
814
815    if(Email == '' || Email == undefined){
816        $("#EnterValidEmail").show();
817        return false;
818    }
819
820    if(!validateEmail(Email)){ // This Function located in /common_library/js/WMPHLogin.js
821        $("#EnterValidEmail").show();
822        return false;
823    }
824    $.ajax({
825        url: '/../../../c/p/ajaxCheckEmail.php',
826        type: 'GET',
827        data: 'Email='+encodeURIComponent(Email)+'&ms=' + datetime,
828        cache: false,
829        success: function(data){
830
831            //console.log('CheckTblForEmail->data='+data);
832
833            if(data.trim() == 'yes'){
834                $("#UserNameIsAvailable").show();
835                $("#UserNameIsNOTAvailable").hide();
836                //console.log('ZZZZ'+data);
837
838                if(CallPostDataFunction=='yes'){
839                    //console.log('CallPostDataFunction='+CallPostDataFunction);
840                    postSignUpData();
841                }
842                return true;
843
844            }else if(data.trim() == 'no'){
845                $("#UserNameIsAvailable").hide();
846                $("#UserNameIsNOTAvailable").show();
847                //console.log('XXXX'+data);
848                return false;
849            }else{
850                connsole.log('Something went wrong in CheckTblForEmailSignUp!');
851                alert('something went wrong - Error code: Rez_10');
852
853            }
854        }
855    });
856
857}
858
859
860function CheckUserNameAvailability(Email, CheckFor){
861
862    if(CheckFor=='' || CheckFor==undefined){CheckFor='';}
863
864    var currentdate = new Date();
865    var datetime =  currentdate.getDate() + "/"
866    + (currentdate.getMonth()+1)  + "/"
867    + currentdate.getFullYear() + " "
868    + currentdate.getHours() + ":"
869    + currentdate.getMinutes() + ":"
870    + currentdate.getSeconds();
871
872
873    if(Email == '' || Email == undefined){
874
875        return false;
876    }
877
878    $.ajax({
879        url: '/../../../c/p/ajaxCheckEmail.php',
880        type: 'GET',
881        data: 'Email='+encodeURIComponent(Email)+'&CheckFor=' + CheckFor+'&ms=' + datetime,
882        cache: false,
883        success: function(data){
884            //console.log("'"+data.trim()+"'");
885            if(data.trim() == 'yes'){
886                $("#UserNameIsNOTAvailable").hide();
887                //return 'yes';
888            }else if(data.trim() == 'no'){
889                $("#UserNameIsNOTAvailable").show();
890                $("#UserNameIsAvailable").hide();
891                //return 'no';
892            }
893            ensbleSave(Email);
894        }
895    });
896}
897
898
899function CheckTblForEmailUpdate(CallPostDataFunction){
900
901    if(CallPostDataFunction=='' || CallPostDataFunction==undefined){CallPostDataFunction='no';}
902
903    var Email=$('#EmailUpdate').val();
904    var EmailUpdateReenter=$('#EmailUpdateReenter').val();
905
906    console.log('email update='+Email);
907
908    var currentdate = new Date();
909    var datetime =  currentdate.getDate() + "/"
910    + (currentdate.getMonth()+1)  + "/"
911    + currentdate.getFullYear() + " "
912    + currentdate.getHours() + ":"
913    + currentdate.getMinutes() + ":"
914    + currentdate.getSeconds();
915
916    $("#EnterValidEmail").hide();
917    $("#EmailMatch").hide();
918    $("#UserNameIsAvailable").hide();
919    $("#UserNameIsNOTAvailable").hide();
920    $(".button-wrapper-email .loading_container").addClass("loading-containerbutton");
921
922    if(!validateEmail(Email)){ // This Function located in /common_library/js/WMPHLogin.js
923        $("#EnterValidEmail").show();
924        return false;
925    }
926
927    if(Email == '' || Email == undefined || EmailUpdateReenter == '' || EmailUpdateReenter == undefined){
928        $("#EnterValidEmail").show();
929        return false;
930    }
931    console.log('email update='+Email+'  was good');
932
933    $.ajax({
934        url: '/../../../c/p/ajaxUpdateEmail.php',
935        type: 'GET',
936        data: 'Email='+encodeURIComponent(Email)+'&EmailUpdateReenter='+encodeURIComponent(EmailUpdateReenter)+'&ms=' + datetime,
937        cache: false,
938        success: function(data){
939            console.log(data);
940            //console.log('CheckTblForEmail->data='+data);
941
942            if(data.trim() == 'Saved!'){
943                alert('Your new email address has been saved!');
944
945                document.location.reload();
946
947            }else if(data.trim() == 'This email address is not avilable!!'){
948                //alert(data.trim());
949
950                $("#UserNameIsAvailable").hide();
951                $("#UserNameIsNOTAvailable").show();
952                //console.log('XXXX'+data);
953                return false;
954            }else{
955                //alert('Something went wrong in CheckTblForEmailSignUp!');
956
957                console.log('Something went wrong in CheckTblForEmailSignUp!');
958                alert('something went wrong - '+data.trim());
959
960            }
961        }
962    });
963
964}
965
966
967
968function CheckSignUpPass(){
969    var Pass=$("#pass").val();
970    if(Pass.length >=8){
971        $("#PassRestriction").hide();
972        $("#PassRestrictionGood").show();
973        return true;
974    }else{
975        $("#PassRestriction").show();
976        return false;
977    }
978}
979
980
981
982function CheckSignInPassForLoginWithWUID(){
983    var Pass=$("#pass").val();
984    if(Pass.length >=1){
985        $("#PassRestriction").hide();
986        return true;
987    }else{
988        $("#PassRestriction").show();
989        return false;
990    }
991}
992
993
994
995
996function CompareSignUpPass(){
997    var Pass=$("#pass").val();
998    var rePass=$("#rePass").val();
999
1000    if(CheckSignUpPass()){
1001        if(Pass!=rePass){
1002            $("#PassDontMatch").show();
1003            $("#PassMatch").hide();
1004            return false;
1005        }else{
1006            $("#PassDontMatch").hide();
1007            $("#PassMatch").show();
1008            return true;
1009        }
1010    }else{
1011        return false;
1012    }
1013
1014}
1015
1016
1017function CloseThisSignUp(){
1018    //$("#exposeMask", window.parent.document).trigger("click");
1019    $('.close').trigger( "click" );
1020    var Email=$("#CheckEmailDivEmail").val();
1021    var Pass=$("#CheckEmailDivPass").val();
1022
1023    // login new user right after they signed up
1024    //parent.SuccessLogIn(Email) // This Function located in /common_library/js/WMPHLogin.js
1025
1026    var CurrentURL= window.location.pathname;
1027    Login(Email,Pass,CurrentURL); // This Function located in /common_library/js/WMPHLogin.js
1028
1029}
1030
1031
1032
1033
1034
1035
1036function SetPass(WUID){
1037
1038    var currentdate = new Date();
1039    var datetime =  currentdate.getDate() + "/"
1040    + (currentdate.getMonth()+1)  + "/"
1041    + currentdate.getFullYear() + " "
1042    + currentdate.getHours() + ":"
1043    + currentdate.getMinutes() + ":"
1044    + currentdate.getSeconds();
1045
1046    $(".bootmodal_lgnpass .modal-body").html('');
1047
1048    console.log('Set Pass for: '+WUID);
1049    $.ajax({
1050        url: '/../../../c/p/SetPass.php',
1051        type: 'POST',
1052        data: 'WUID='+WUID+'&ms=' + datetime,
1053        success: function(data){
1054
1055            $(".bootmodal_lgnpass .modal-body").html(data);
1056
1057        }
1058
1059    });
1060}
1061
1062
1063
1064function SetPassCheckPass(){
1065    var Pass=$("#pass").val();
1066    if(Pass.length >=8){
1067        $("#PassRestriction").hide();
1068        $("#PassRestrictionGood").show();
1069    }else{
1070        $("#PassRestriction").show();
1071        $("#PassRestrictionGood").hide();
1072        return false;
1073    }
1074
1075}
1076function SetPassComparePass(){
1077    var Pass=$("#pass").val();
1078    var rePass=$("#rePass").val();
1079
1080    SetPassCheckPass();
1081
1082    if(Pass.length >=8){
1083        if(Pass!=rePass){
1084            $("#PassDontMatch").show();
1085            $("#PassMatch").hide();
1086            return false;
1087        }else{
1088            $("#PassDontMatch").hide();
1089            $("#PassMatch").show();
1090        }
1091    }
1092
1093}
1094
1095
1096function SetPassPostData(WUID){
1097
1098    $("#SetPassConfirm").hide();
1099
1100    var currentdate = new Date();
1101    var datetime =  currentdate.getDate() + "/"
1102    + (currentdate.getMonth()+1)  + "/"
1103    + currentdate.getFullYear() + " "
1104    + currentdate.getHours() + ":"
1105    + currentdate.getMinutes() + ":"
1106    + currentdate.getSeconds();
1107
1108    var Pass=encodeURIComponent($("#pass").val());
1109    var rePass=encodeURIComponent($("#rePass").val());
1110    var Email=encodeURIComponent($("#email").val());
1111
1112    //alert('Email='+Email+'&Pass=' + Pass+'&rePass=' + rePass+'&ms=' + datetime);
1113
1114    $.ajax({
1115        url: '/../../c/p/ajaxSetPass.php',
1116        type: 'POST',
1117        data: 'Email='+Email+'&Pass=' + Pass+'&rePass=' + rePass+'&WUID=' + WUID+'&ms=' + datetime,
1118        cache: false,
1119        success: function(data){
1120
1121            //alert(data);
1122            if(data.trim()=='ok'){
1123                //password changed successfully
1124                $("#SetPassDiv").hide();
1125                $("#SetPassConfirm").show();
1126            }
1127        }
1128    });
1129}
1130
1131
1132
1133function UpdatePassPostData(WUID){
1134
1135    $("#SetPassConfirm").hide();
1136    var CurrentPass =($("#curPassword").val());
1137    var Pass=encodeURIComponent($("#pass").val());
1138    var rePass=encodeURIComponent($("#rePass").val());
1139
1140
1141
1142    var currentdate = new Date();
1143    var datetime =  currentdate.getDate() + "/"
1144    + (currentdate.getMonth()+1)  + "/"
1145    + currentdate.getFullYear() + " "
1146    + currentdate.getHours() + ":"
1147    + currentdate.getMinutes() + ":"
1148    + currentdate.getSeconds();
1149
1150
1151    //alert('Email='+Email+'&Pass=' + Pass+'&rePass=' + rePass+'&ms=' + datetime);
1152
1153    $.ajax({
1154        url: '/../../c/p/ajaxUpdatePass.php',
1155        type: 'POST',
1156        data: 'NewPass=' + Pass+'&NewRePass=' + rePass+'&CurrentPass=' + CurrentPass+'&WUID=' + WUID+'&ms=' + datetime,
1157        cache: false,
1158        success: function(data){
1159
1160            //alert(data);
1161            if(data.trim()=='ok'){
1162                //password changed successfully
1163                alert('Your new password has been saved!');
1164                /*document.location.reload();*/
1165
1166                if($(".msigninHeaderLink").length){
1167                    window.location.href= "/cm/Profile.php";
1168                }else{
1169                    window.location.href= "/c/p/Profile.php";
1170                }
1171            }else{
1172                console.log('Data from UpdatePassPostData=> '+data);
1173            }
1174        }
1175    });
1176
1177}
1178
1179
1180
1181
1182function CheckCurrentPass(WUID, CurrentPass){
1183
1184    console.log('WUID= '+WUID);
1185    console.log('CheckCurrentPass= '+CurrentPass);
1186
1187    if(WUID == ''){
1188        alert('Something went wrong, please contact customer service for more help.');
1189        return false;
1190    }
1191
1192    if(CurrentPass == ''){
1193        $("#CurrentPassMatch").show();
1194        return false;
1195    }
1196
1197    $("#CurrentPassMatch").hide();
1198
1199    var currentdate = new Date();
1200    var datetime =  currentdate.getDate() + "/"
1201    + (currentdate.getMonth()+1)  + "/"
1202    + currentdate.getFullYear() + " "
1203    + currentdate.getHours() + ":"
1204    + currentdate.getMinutes() + ":"
1205    + currentdate.getSeconds();
1206
1207
1208    //alert('Email='+Email+'&Pass=' + Pass+'&rePass=' + rePass+'&ms=' + datetime);
1209
1210    $.ajax({
1211        url: '/../../c/p/ajaxCheckCurrentPass.php',
1212        type: 'POST',
1213        data: 'CurrentPass=' + CurrentPass+'&WUID=' + WUID+'&ms=' + datetime,
1214        cache: false,
1215        success: function(data){
1216            console.log('Data from CheckCurrentPass=> '+data);
1217            console.log('Trimmed data from CheckCurrentPass=> '+data.trim());
1218            //alert(data);
1219            if(data.trim() =='error'){
1220                //password changed successfully
1221                $("#CurrentPassMatch").show();
1222                console.log('CheckCurrentPass= faied');
1223
1224                return false;
1225            }else if(data.trim() =='ok'){
1226                $("#CurrentPassMatch").hide();
1227                console.log('CheckCurrentPass= success');
1228                return true;
1229            }else{
1230                console.log('CheckCurrentPass= unknown!');
1231                console.log('data= ' +data);
1232                return false;
1233            }
1234        }
1235    });
1236}

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.