add ocid based login
This commit is contained in:
parent
d83309d4cd
commit
34af2b1fab
12 changed files with 131 additions and 28 deletions
|
|
@ -337,7 +337,11 @@ pandora.ui.accountSignoutDialog = function() {
|
|||
that.close();
|
||||
pandora.UI.set({page: ''});
|
||||
pandora.api.signout({}, function(result) {
|
||||
pandora.signout(result.data);
|
||||
if (pandora.site.site.oidc) {
|
||||
pandora.oidcLogout();
|
||||
} else {
|
||||
pandora.signout(result.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -100,6 +100,10 @@ pandora.ui.appPanel = function() {
|
|||
pandora.$ui.siteDialog = pandora.ui.siteDialog(page).open();
|
||||
}
|
||||
} else if (['signup', 'signin'].indexOf(page) > -1) {
|
||||
if (pandora.site.site.oidc) {
|
||||
pandora.oidcLogin()
|
||||
return
|
||||
}
|
||||
if (pandora.user.level == 'guest') {
|
||||
if (pandora.$ui.accountDialog && pandora.$ui.accountDialog.is(':visible')) {
|
||||
pandora.$ui.accountDialog.options(pandora.ui.accountDialogOptions(page));
|
||||
|
|
|
|||
|
|
@ -424,26 +424,35 @@ pandora.ui.folders = function(section) {
|
|||
}).bindEvent({
|
||||
click: function() {
|
||||
var $dialog = pandora.ui.iconDialog({
|
||||
buttons: title != Ox._('Featured ' + folderItems) ? [
|
||||
Ox.Button({title: Ox._('Sign Up...')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
pandora.$ui.accountDialog = pandora.ui.accountDialog('signup').open();
|
||||
}
|
||||
}),
|
||||
Ox.Button({title: Ox._('Sign In...')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
pandora.$ui.accountDialog = pandora.ui.accountDialog('signin').open();
|
||||
}
|
||||
}),
|
||||
{},
|
||||
Ox.Button({title: Ox._('Not Now')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
}
|
||||
})
|
||||
] : [
|
||||
buttons: title != Ox._('Featured ' + folderItems) ? [].concat(
|
||||
pandora.site.site.oidc ? []
|
||||
: [
|
||||
Ox.Button({title: Ox._('Sign Up...')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
pandora.$ui.accountDialog = pandora.ui.accountDialog('signup').open();
|
||||
}
|
||||
})
|
||||
],
|
||||
[
|
||||
Ox.Button({title: Ox._('Sign In...')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
if (pandora.site.site.oidc) {
|
||||
pandora.oidcLogin()
|
||||
} else {
|
||||
pandora.$ui.accountDialog = pandora.ui.accountDialog('signin').open();
|
||||
}
|
||||
}
|
||||
}),
|
||||
{},
|
||||
Ox.Button({title: Ox._('Not Now')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
}
|
||||
})
|
||||
]
|
||||
): [
|
||||
Ox.Button({title: Ox._('Close')}).bindEvent({
|
||||
click: function() {
|
||||
$dialog.close();
|
||||
|
|
|
|||
|
|
@ -171,13 +171,13 @@ pandora.ui.home = function() {
|
|||
}),
|
||||
$signinButton = Ox.Button({
|
||||
title: Ox._('Sign In'),
|
||||
width: 74
|
||||
width: pandora.site.site.oidc ? 156 : 74
|
||||
})
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: '112px',
|
||||
right: '82px',
|
||||
right: pandora.site.site.oidc ? '164px' : '82px',
|
||||
bottom: 0,
|
||||
margin: 'auto',
|
||||
opacity: 0
|
||||
|
|
@ -248,7 +248,13 @@ pandora.ui.home = function() {
|
|||
adjustRatio();
|
||||
|
||||
if (pandora.user.level == 'guest') {
|
||||
$signupButton.appendTo(that);
|
||||
if (pandora.site.site.oidc) {
|
||||
$signinButton.options({
|
||||
width: 156
|
||||
})
|
||||
} else {
|
||||
$signupButton.appendTo(that);
|
||||
}
|
||||
$signinButton.appendTo(that);
|
||||
} else {
|
||||
$preferencesButton.appendTo(that);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'tasks', title: Ox._('Tasks...'), disabled: isGuest },
|
||||
{ id: 'archives', title: Ox._('Archives...'), disabled: /*isGuest*/ true },
|
||||
{},
|
||||
{ id: 'signup', title: Ox._('Sign Up...'), disabled: !isGuest },
|
||||
!pandora.site.site.oidc
|
||||
? { id: 'signup', title: Ox._('Sign Up...'), disabled: !isGuest }
|
||||
: [],
|
||||
isGuest ? { id: 'signin', title: Ox._('Sign In...')}
|
||||
: { id: 'signout', title: Ox._('Sign Out...')}
|
||||
] },
|
||||
|
|
|
|||
|
|
@ -2650,6 +2650,20 @@ pandora.logEvent = function(data, event, element) {
|
|||
}
|
||||
};
|
||||
|
||||
pandora.oidcLogin = function() {
|
||||
Ox.LoadingScreen().css({zIndex: 100}).addClass('OxScreen').appendTo(document.body).show().start()
|
||||
document.location.href = '/oidc/authenticate/';
|
||||
};
|
||||
|
||||
pandora.oidcLogout = function() {
|
||||
Ox.LoadingScreen().css({zIndex: 100}).addClass('OxScreen').appendTo(document.body).show().start()
|
||||
const form = document.createElement("form");
|
||||
form.setAttribute("method", "post");
|
||||
form.setAttribute("action", "/oidc/logout/");
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
};
|
||||
|
||||
pandora.openLicenseDialog = function() {
|
||||
if (!Ox.Focus.focusedElementIsInput() && !pandora.hasDialogOrScreen()) {
|
||||
pandora.ui.licenseDialog().open().bindEvent({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue