Fix bug 'if OIDC button text was customized, the default text will be added if a user click on sing in'

This commit is contained in:
Emile NDAGIJIMANA 2021-10-12 17:41:12 +02:00
parent 37a3fbf69c
commit 6cd59f8ce1
2 changed files with 52 additions and 6 deletions

View file

@ -6,6 +6,9 @@ const i18nTagToT9n = i18nTag => {
return i18nTag;
};
let alreadyCheck = 1;
let isCheckDone = false;
const validator = {
set(obj, prop, value) {
if (prop === 'state' && value !== 'signIn') {
@ -166,6 +169,49 @@ Template.userFormsLayout.events({
});
}
},
'DOMSubtreeModified #at-oidc'(event){
if(alreadyCheck <= 2){
let currSetting = Settings.findOne();
let oidcBtnElt = $("#at-oidc");
if(currSetting && currSetting !== undefined && currSetting.oidcBtnText !== undefined && oidcBtnElt != null && oidcBtnElt != undefined){
let htmlvalue = "<i class='fa fa-oidc'></i>" + currSetting.oidcBtnText;
if(alreadyCheck == 1){
alreadyCheck++;
oidcBtnElt.html("");
}
else{
alreadyCheck++;
oidcBtnElt.html(htmlvalue);
}
}
}
else{
alreadyCheck = 1;
}
},
'DOMSubtreeModified .at-form'(event){
if(alreadyCheck <= 2 && !isCheckDone){
if(document.getElementById("at-oidc") != null){
let currSetting = Settings.findOne();
let oidcBtnElt = $("#at-oidc");
if(currSetting && currSetting !== undefined && currSetting.oidcBtnText !== undefined && oidcBtnElt != null && oidcBtnElt != undefined){
let htmlvalue = "<i class='fa fa-oidc'></i>" + currSetting.oidcBtnText;
if(alreadyCheck == 1){
alreadyCheck++;
oidcBtnElt.html("");
}
else{
alreadyCheck++;
isCheckDone = true;
oidcBtnElt.html(htmlvalue);
}
}
}
}
else{
alreadyCheck = 1;
}
},
});
Template.defaultLayout.events({