mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
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:
parent
37a3fbf69c
commit
6cd59f8ce1
2 changed files with 52 additions and 6 deletions
|
@ -86,7 +86,7 @@ BlazeComponent.extendComponent({
|
|||
});
|
||||
},
|
||||
userHasTeams(){
|
||||
if(Meteor.user().teams && Meteor.user().teams.length > 0)
|
||||
if(Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -98,7 +98,7 @@ BlazeComponent.extendComponent({
|
|||
return [];
|
||||
},
|
||||
userHasOrgs(){
|
||||
if(Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
||||
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -111,13 +111,13 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
userHasOrgsOrTeams(){
|
||||
let boolUserHasOrgs;
|
||||
if(Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
||||
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
||||
boolUserHasOrgs = true;
|
||||
else
|
||||
boolUserHasOrgs = false;
|
||||
|
||||
let boolUserHasTeams;
|
||||
if(Meteor.user().teams && Meteor.user().teams.length > 0)
|
||||
if(Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
|
||||
boolUserHasTeams = true;
|
||||
else
|
||||
boolUserHasTeams = false;
|
||||
|
@ -153,7 +153,7 @@ BlazeComponent.extendComponent({
|
|||
// },
|
||||
// });
|
||||
|
||||
let orgIdsUserBelongs = currUser.teams !== 'undefined' ? currUser.orgIdsUserBelongs() : '';
|
||||
let orgIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.orgIdsUserBelongs() : '';
|
||||
if(orgIdsUserBelongs && orgIdsUserBelongs != ''){
|
||||
let orgsIds = orgIdsUserBelongs.split(',');
|
||||
// for(let i = 0; i < orgsIds.length; i++){
|
||||
|
@ -164,7 +164,7 @@ BlazeComponent.extendComponent({
|
|||
query.$and[2].$or.push({'orgs.orgId': {$in : orgsIds}});
|
||||
}
|
||||
|
||||
let teamIdsUserBelongs = currUser.teams !== 'undefined' ? currUser.teamIdsUserBelongs() : '';
|
||||
let teamIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.teamIdsUserBelongs() : '';
|
||||
if(teamIdsUserBelongs && teamIdsUserBelongs != ''){
|
||||
let teamsIds = teamIdsUserBelongs.split(',');
|
||||
// for(let i = 0; i < teamsIds.length; i++){
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue