Search code examples
gigya

in Gigya, Unable to set attribute in "email" of Screen "Forget Password" in Screen-sets ID "Default-LinkAccounts"


I have the following js implemented in Gigya JavaScript Parameters:

onAfterScreenLoad: function(event) {

    if ((ell = document.querySelector("#gigya-forgot-password-screen input[type=text][name=loginID]")) != null){
        ell.setAttribute('type', 'email');
        ell.setAttribute('placeholder', '[email protected]'); 
        ell.setAttribute('autocomplete', 'off'); 
    }
},

I am able to use the above code to handle the fields of all other screen-sets EXCEPT this "Forget Password" screen (i.e. Screen ID: gigya-forgot-password-screen) in Screen-sets ID "Default-LinkAccounts". It looks like the forgot password flow is triggered without a user session and independently of the information passed into the Email field on the login screen. If it is, then how to implement this.


Solution

  • it seems the name of the field is different depending upon which screen you are using:

    window.ell = document.querySelector("#gigya-register-screen input[type=text][name=email]");
    
    window.ell = document.querySelector("#gigya-login-screen input[type=text][name=username]");
    
    window.ell = document.querySelector("#gigya-forgot-password-screen input[type=text][name=username]");
    

    so:

    onAfterScreenLoad: function(event) {
        var ell = null;
        if ((event.currentScreen === "gigya-forgot-password-screen") || (event.currentScreen === "gigya-login-screen")) {
            ell = document.querySelector("#" + event.currentScreen + " input[type=text][name=username]");
        } else if (event.currentScreen === "gigya-register-screen") {
            ell = document.querySelector("#gigya-register-screen input[type=text][name=email]");
        }
        if (ell != null){       
            ell.setAttribute('type', 'email');
            ell.setAttribute('placeholder', '[email protected]'); 
            ell.setAttribute('autocomplete', 'off'); 
        }
    }
    

    enter image description here