Added back autologin, because reverting it broke Google OIDC login.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2022-09-01 12:12:30 +03:00
parent ba1d04b99f
commit 1e4fba3ec8
5 changed files with 93 additions and 34 deletions

View file

@ -5,6 +5,16 @@ const emailField = AccountsTemplates.removeField('email');
let disableRegistration = false;
let disableForgotPassword = false;
let passwordLoginDisabled = false;
let oidcRedirectionEnabled = false;
let oauthServerUrl = "home";
let oauthDashboardUrl = "";
Meteor.call('isOidcRedirectionEnabled', (_, result) => {
if(result)
{
oidcRedirectionEnabled = true;
}
});
Meteor.call('isPasswordLoginDisabled', (_, result) => {
if (result) {
@ -14,6 +24,18 @@ Meteor.call('isPasswordLoginDisabled', (_, result) => {
}
});
Meteor.call('getOauthServerUrl', (_, result) => {
if (result) {
oauthServerUrl = result;
}
});
Meteor.call('getOauthDashboardUrl', (_, result) => {
if (result) {
oauthDashboardUrl = result;
}
});
Meteor.call('isDisableRegistration', (_, result) => {
if (result) {
disableRegistration = true;
@ -59,11 +81,19 @@ AccountsTemplates.configure({
showForgotPasswordLink: !disableForgotPassword,
forbidClientAccountCreation: disableRegistration,
onLogoutHook() {
const homePage = 'home';
if (FlowRouter.getRouteName() === homePage) {
FlowRouter.reload();
} else {
FlowRouter.go(homePage);
// here comeslogic for redirect
if(oidcRedirectionEnabled)
{
window.location = oauthServerUrl + oauthDashboardUrl;
}
else
{
const homePage = 'home';
if (FlowRouter.getRouteName() === homePage) {
FlowRouter.reload();
} else {
FlowRouter.go(homePage);
}
}
},
});