mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-12 19:49:59 +05:00
fix(sso): redirect to correct page on request login
This commit is contained in:
parent
5d9147408c
commit
b3b0593b48
@ -49,12 +49,17 @@ define([
|
||||
};
|
||||
if (window.location.hash) { setRedirectTo(); }
|
||||
|
||||
Exports.ssoRedirectTo = (localData) => {
|
||||
redirectTo = localData?.redirectTo || redirectTo;
|
||||
};
|
||||
Exports.ssoAuth = function (provider, cb) {
|
||||
var keys = Nacl.sign.keyPair();
|
||||
var inviteToken = window.location.hash.slice(1);
|
||||
|
||||
localStorage.CP_sso_auth = JSON.stringify({
|
||||
s: Util.encodeBase64(keys.secretKey),
|
||||
p: Util.encodeBase64(keys.publicKey),
|
||||
redirectTo,
|
||||
token: inviteToken
|
||||
});
|
||||
ServerCommand(keys, {
|
||||
|
||||
@ -14,10 +14,11 @@ define([
|
||||
'/common/outer/http-command.js',
|
||||
'/common/outer/local-store.js',
|
||||
'/common/outer/login-block.js',
|
||||
'/customize/login.js',
|
||||
'/customize/messages.js',
|
||||
'/common/common-icons.js',
|
||||
], function (ApiConfig, $, h, Util, Cred, UI, Login, Constants,
|
||||
ServerCommand, LocalStore, Block, Messages, Icons) {
|
||||
ServerCommand, LocalStore, Block, CLogin, Messages, Icons) {
|
||||
if (window.top !== window) { return; }
|
||||
|
||||
let ssoAuthCb = function (cb) {
|
||||
@ -31,6 +32,7 @@ define([
|
||||
publicKey: Util.decodeBase64(b64Keys.p)
|
||||
};
|
||||
var inviteToken = b64Keys.token;
|
||||
CLogin.ssoRedirectTo(b64Keys);
|
||||
ServerCommand(keys, {
|
||||
command: 'SSO_AUTH_CB',
|
||||
url: window.location.href
|
||||
@ -63,7 +65,7 @@ define([
|
||||
return void UI.warn(msg);
|
||||
}
|
||||
LocalStore.setSSOSeed(seed.toLowerCase());
|
||||
window.location.href = '/drive/';
|
||||
CLogin.redirect();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user