fix: sso redirect on /login & /api/login

This commit is contained in:
Barış Soner Uşaklı
2020-12-03 10:29:18 -05:00
parent c7f2640a18
commit 5d00b0895b
3 changed files with 26 additions and 11 deletions

View File

@@ -145,12 +145,18 @@ ajaxify = window.ajaxify || {};
app.alertError('[[global:please_log_in]]');
app.previousUrl = url;
window.location.href = config.relative_path + '/login';
} else if ((status === 302 || status === 308) && typeof data.responseJSON === 'string') {
ajaxifyTimer = undefined;
if (data.responseJSON.startsWith('http://') || data.responseJSON.startsWith('https://')) {
window.location.href = data.responseJSON;
} else {
ajaxify.go(data.responseJSON.slice(1), callback, quiet);
} else if (status === 302 || status === 308) {
if (data.responseJSON && data.responseJSON.external) {
// this is used by sso plugins to redirect to the auth route
// cant use ajaxify.go for /auth/sso routes
window.location.href = data.responseJSON.external;
} else if (typeof data.responseJSON === 'string') {
ajaxifyTimer = undefined;
if (data.responseJSON.startsWith('http://') || data.responseJSON.startsWith('https://')) {
window.location.href = data.responseJSON;
} else {
ajaxify.go(data.responseJSON.slice(1), callback, quiet);
}
}
}
} else if (textStatus !== 'abort') {