[auth] oauth - handle subdomains - include unpublished versions
This commit is contained in:
parent
d5ce2c9e5e
commit
7fd9a4e46a
|
@ -439,7 +439,7 @@ router.get('/user/social/:provider', handleErrorAsync(async (req, res) => {
|
||||||
if (!req.session.socialRedirect) {
|
if (!req.session.socialRedirect) {
|
||||||
return '/' + config.user.route;
|
return '/' + config.user.route;
|
||||||
}
|
}
|
||||||
const host = buildLocaleList(config.locale)[req.session.socialRedirect].url;
|
const host = buildLocaleList(config.locale, true)[req.session.socialRedirect].url;
|
||||||
delete req.session.socialRedirect;
|
delete req.session.socialRedirect;
|
||||||
|
|
||||||
return `${host}/api/user/social-redirect-callback/${encodeURIComponent(token)}`;
|
return `${host}/api/user/social-redirect-callback/${encodeURIComponent(token)}`;
|
||||||
|
|
|
@ -149,10 +149,10 @@ export const isTroll = (body) => {
|
||||||
return ['cipeusz', 'feminazi', 'bruksela', 'zboczeń'].some(t => body.indexOf(t) > -1);
|
return ['cipeusz', 'feminazi', 'bruksela', 'zboczeń'].some(t => body.indexOf(t) > -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildLocaleList = (current) => {
|
export const buildLocaleList = (current, includeUnpublished = false) => {
|
||||||
return buildDict(function* () {
|
return buildDict(function* () {
|
||||||
for (let [code, name, url, published] of locales) {
|
for (let [code, name, url, published] of locales) {
|
||||||
if (published || current === code) {
|
if (published || current === code || includeUnpublished) {
|
||||||
yield [code, {name, url, published}];
|
yield [code, {name, url, published}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue