wip redirect on landing page and logout to oidc provider

This commit is contained in:
viehlieb 2022-05-11 09:05:43 +02:00
parent b97c51abde
commit 2e354f9b1e
7 changed files with 92 additions and 15 deletions

View file

@ -8,7 +8,7 @@ const i18nTagToT9n = i18nTag => {
let alreadyCheck = 1;
let isCheckDone = false;
let counter = 0;
const validator = {
set(obj, prop, value) {
if (prop === 'state' && value !== 'signIn') {
@ -54,6 +54,46 @@ Template.userFormsLayout.onCreated(function() {
}
});
Meteor.call('isOidcRedirectionEnabled', (_, result) => {
serviceName = 'oidc';
if (result) {
if(Session.get("tmp") && ((Math.floor(Date.now() / 1000) - Session.get("tmp") < 5) ))
{
window.location.reload(true);
console.log(Meteor.user().profile);
}
else
{
Session.set("tmp", Math.floor(Date.now() / 1000));
console.log("Säschön", Session.get("tmp"));
methodName = "loginWithOidc";
var loginWithService = Meteor[methodName];
AccountsTemplates.options.socialLoginStyle = 'redirect';
options = {
loginStyle: AccountsTemplates.options.socialLoginStyle,
};
console.log("keys", options);
loginWithService(options, function(err) {
AccountsTemplates.setDisabled(false);
if (err && err instanceof Accounts.LoginCancelledError)
{
console.log("login cancelled");
}
else if (err && err instanceof ServiceConfiguration.ConfigError)
{
console.log("service config");
if (Accounts._loginButtonsSession) return Accounts._loginButtonsSession.configureService('oidc');
}
else
{
console.log("else_block");
AccountsTemplates.submitCallback(err, state);
}
});
}
}
else console.log("kein result");
});
Meteor.call('isDisableRegistration', (_, result) => {
if (result) {
$('.at-signup-link').hide();
@ -286,6 +326,7 @@ Template.userFormsLayout.events({
event.preventDefault();
},
'click #at-btn'(event, templateInstance) {
console.log("hello");
if (FlowRouter.getRouteName() === 'atSignIn') {
templateInstance.isLoading.set(true);
authentication(event, templateInstance).then(() => {