(js) follow requested URL after authentication

pull/237/merge
Francis Lachapelle 2017-08-29 16:03:19 -04:00
parent ee7fdcba9f
commit a65e96bdb5
2 changed files with 6 additions and 12 deletions

2
NEWS
View File

@ -7,7 +7,7 @@ New features
- [web] register SOGo as a handler for the mailto scheme (#1223)
Enhancements
-
- [web] follow requested URL after user authentication
Bug fixes
- [core] yearly repeating events are not shown in web calendar (#4237)

View File

@ -27,29 +27,23 @@
function Authentication() {
function redirectUrl(username, domain) {
var userName, address, baseAddress, altBaseAddress, parts, hostpart, protocol, newAddress;
var userName, address, baseAddress, parts, hostpart, protocol, newAddress;
userName = username;
if (domain)
userName += '@' + domain.value;
address = '' + window.location.href;
baseAddress = ApplicationBaseURL + '/' + encodeURIComponent(userName);
baseAddress = ApplicationBaseURL + encodeURIComponent(userName);
if (baseAddress[0] == '/') {
parts = address.split('/');
hostpart = parts[2];
protocol = parts[0];
baseAddress = protocol + '//' + hostpart + baseAddress;
}
parts = baseAddress.split('/');
parts.splice(0, 3);
altBaseAddress = parts.join('/');
if ((address.startsWith(baseAddress) || address.startsWith(altBaseAddress)) &&
!address.endsWith('/logoff')) {
if (address.startsWith(baseAddress) && !address.endsWith('/logoff'))
newAddress = address;
}
else {
else
newAddress = baseAddress;
}
return newAddress;
}
@ -124,7 +118,7 @@
}
}
else {
d.resolve(redirectUrl(username, domain));
d.resolve({ url: redirectUrl(username, domain) });
}
}
}, function(response) {