Fix SSO login with subpaths (#4496)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2020-06-26 22:50:53 +02:00 committed by GitHub
parent a968db07f7
commit a9e56cb315
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,7 +109,15 @@ class SSO extends PureComponent {
}
extractCookie = (parsedUrl) => {
CookieManager.get(parsedUrl.origin, true).then((res) => {
const original = urlParse(this.props.serverUrl);
// Check whether we need to set a sub-path
parsedUrl.set('pathname', original.pathname || '');
parsedUrl.set('query', '');
Client4.setUrl(parsedUrl.href);
CookieManager.get(parsedUrl.href, true).then((res) => {
const mmtoken = res.MMAUTHTOKEN;
const token = typeof mmtoken === 'object' ? mmtoken.value : mmtoken;
@ -121,13 +129,6 @@ class SSO extends PureComponent {
} = this.props.actions;
Client4.setToken(token);
if (this.props.serverUrl !== parsedUrl.origin) {
const original = urlParse(this.props.serverUrl);
// Check whether we need to set a sub-path
parsedUrl.set('pathname', original.pathname || '');
Client4.setUrl(parsedUrl.href);
}
ssoLogin(token).then((result) => {
if (result.error) {
this.onLoadEndError(result.error);