mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Merge pull request #4052 from Emile840/master
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:
commit
d39e8bc03a
2 changed files with 52 additions and 6 deletions
|
@ -86,7 +86,7 @@ BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
userHasTeams(){
|
userHasTeams(){
|
||||||
if(Meteor.user().teams && Meteor.user().teams.length > 0)
|
if(Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,7 +98,7 @@ BlazeComponent.extendComponent({
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
userHasOrgs(){
|
userHasOrgs(){
|
||||||
if(Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -111,13 +111,13 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
userHasOrgsOrTeams(){
|
userHasOrgsOrTeams(){
|
||||||
let boolUserHasOrgs;
|
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;
|
boolUserHasOrgs = true;
|
||||||
else
|
else
|
||||||
boolUserHasOrgs = false;
|
boolUserHasOrgs = false;
|
||||||
|
|
||||||
let boolUserHasTeams;
|
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;
|
boolUserHasTeams = true;
|
||||||
else
|
else
|
||||||
boolUserHasTeams = false;
|
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 != ''){
|
if(orgIdsUserBelongs && orgIdsUserBelongs != ''){
|
||||||
let orgsIds = orgIdsUserBelongs.split(',');
|
let orgsIds = orgIdsUserBelongs.split(',');
|
||||||
// for(let i = 0; i < orgsIds.length; i++){
|
// for(let i = 0; i < orgsIds.length; i++){
|
||||||
|
@ -164,7 +164,7 @@ BlazeComponent.extendComponent({
|
||||||
query.$and[2].$or.push({'orgs.orgId': {$in : orgsIds}});
|
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 != ''){
|
if(teamIdsUserBelongs && teamIdsUserBelongs != ''){
|
||||||
let teamsIds = teamIdsUserBelongs.split(',');
|
let teamsIds = teamIdsUserBelongs.split(',');
|
||||||
// for(let i = 0; i < teamsIds.length; i++){
|
// for(let i = 0; i < teamsIds.length; i++){
|
||||||
|
|
|
@ -6,6 +6,9 @@ const i18nTagToT9n = i18nTag => {
|
||||||
return i18nTag;
|
return i18nTag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let alreadyCheck = 1;
|
||||||
|
let isCheckDone = false;
|
||||||
|
|
||||||
const validator = {
|
const validator = {
|
||||||
set(obj, prop, value) {
|
set(obj, prop, value) {
|
||||||
if (prop === 'state' && value !== 'signIn') {
|
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({
|
Template.defaultLayout.events({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue