0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

fix(core): let ac SIE language load from default SIE language settings

let ac SIE language load from default SIR language settings
This commit is contained in:
simeng-li 2022-10-20 18:40:45 +08:00
parent 2e03d18c3e
commit e0aaf64f82
No known key found for this signature in database
GPG key ID: 14EA7BB1541E8075
2 changed files with 7 additions and 5 deletions

View file

@ -100,7 +100,6 @@ describe('GET /.well-known/sign-in-exp', () => {
it('should return admin console settings', async () => { it('should return admin console settings', async () => {
interactionDetails.mockResolvedValue({ params: { client_id: adminConsoleApplicationId } }); interactionDetails.mockResolvedValue({ params: { client_id: adminConsoleApplicationId } });
const response = await sessionRequest.get('/.well-known/sign-in-exp'); const response = await sessionRequest.get('/.well-known/sign-in-exp');
expect(signInExperienceQuerySpyOn).not.toBeCalled();
expect(response.status).toEqual(200); expect(response.status).toEqual(200);
expect(response.body).toMatchObject({ expect(response.body).toMatchObject({
@ -109,6 +108,7 @@ describe('GET /.well-known/sign-in-exp', () => {
...adminConsoleSignInExperience.branding, ...adminConsoleSignInExperience.branding,
slogan: 'admin_console.welcome.title', slogan: 'admin_console.welcome.title',
}, },
languageInfo: mockSignInExperience.languageInfo,
socialConnectors: [], socialConnectors: [],
signInMode: SignInMode.SignIn, signInMode: SignInMode.SignIn,
}); });

View file

@ -30,6 +30,11 @@ export default function wellKnownRoutes<T extends AnonymousRouter>(router: T, pr
throw error; throw error;
}); });
const [signInExperience, logtoConnectors] = await Promise.all([
findDefaultSignInExperience(),
getLogtoConnectors(),
]);
// Hard code AdminConsole sign-in methods settings. // Hard code AdminConsole sign-in methods settings.
if (interaction?.params.client_id === adminConsoleApplicationId) { if (interaction?.params.client_id === adminConsoleApplicationId) {
ctx.body = { ctx.body = {
@ -38,6 +43,7 @@ export default function wellKnownRoutes<T extends AnonymousRouter>(router: T, pr
...adminConsoleSignInExperience.branding, ...adminConsoleSignInExperience.branding,
slogan: i18next.t('admin_console.welcome.title'), slogan: i18next.t('admin_console.welcome.title'),
}, },
languageInfo: signInExperience.languageInfo,
signInMode: (await hasActiveUsers()) ? SignInMode.SignIn : SignInMode.Register, signInMode: (await hasActiveUsers()) ? SignInMode.SignIn : SignInMode.Register,
socialConnectors: [], socialConnectors: [],
}; };
@ -46,10 +52,6 @@ export default function wellKnownRoutes<T extends AnonymousRouter>(router: T, pr
} }
// Custom Applications // Custom Applications
const [signInExperience, logtoConnectors] = await Promise.all([
findDefaultSignInExperience(),
getLogtoConnectors(),
]);
const socialConnectors = signInExperience.socialSignInConnectorTargets.reduce< const socialConnectors = signInExperience.socialSignInConnectorTargets.reduce<
Array<ConnectorMetadata & { id: string }> Array<ConnectorMetadata & { id: string }>