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

99封情书 提交于 2019-12-11 17:20:02

问题


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', 'user@example.com'); 
        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.


回答1:


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', 'user@example.com'); 
        ell.setAttribute('autocomplete', 'off'); 
    }
}



来源:https://stackoverflow.com/questions/47875538/in-gigya-unable-to-set-attribute-in-email-of-screen-forget-password-in-scre

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!