Improve local auth env handling and fallbacks
Allow local env files to reliably override authentication feature flags (SMS/WeChat) by whitelisting keys in scripts/dev-utils.mjs and adding a unit test. Add SMS checks to scripts/check-api-server-env.mjs. Make server config.parse_bool tolerant of shell-wrapped quoted values (e.g. '"true"') and add tests so SMS_AUTH_ENABLED is parsed correctly when shells supply quotes. Update docs to clarify SMS env behaviour, restart requirements, and add guidance + a CSS fallback for old mobile browsers (QQ/X5) so public cover images render even when aspect-ratio is unsupported. Also include related frontend test and component adjustments and add puzzle onboarding handlers/endpoints in server-rs/crates/api-server/src/puzzle.rs.
This commit is contained in:
@@ -316,7 +316,7 @@ test('auth gate does not auto-create a guest account when dev guest switch is no
|
||||
expect(await screen.findByText('应用内容')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('auth gate keeps password entry available when login options are empty', async () => {
|
||||
test('auth gate keeps sms and password entries available when login options are empty', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
authMocks.getCurrentAuthUser.mockResolvedValue({
|
||||
@@ -336,12 +336,19 @@ test('auth gate keeps password entry available when login options are empty', as
|
||||
await user.click(await screen.findByRole('button', { name: '进入作品' }));
|
||||
|
||||
const dialog = screen.getByRole('dialog', { name: '账号入口' });
|
||||
expect(within(dialog).getByRole('tab', { name: '短信登录' })).toBeTruthy();
|
||||
expect(within(dialog).getByRole('tab', { name: '密码登录' })).toBeTruthy();
|
||||
expect(within(dialog).getByLabelText('验证码')).toBeTruthy();
|
||||
expect(
|
||||
within(dialog).getByRole('button', { name: '获取验证码' }),
|
||||
).toBeTruthy();
|
||||
await user.click(within(dialog).getByRole('tab', { name: '密码登录' }));
|
||||
expect(within(dialog).getByLabelText('密码')).toBeTruthy();
|
||||
expect(within(dialog).queryByText('当前登录入口暂不可用。')).toBeNull();
|
||||
expect(within(dialog).queryByText('读取登录方式失败')).toBeNull();
|
||||
});
|
||||
|
||||
test('auth gate falls back to password entry when login options request fails', async () => {
|
||||
test('auth gate keeps sms and password entries available when login options request fails', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
authMocks.getAuthLoginOptions.mockRejectedValue(
|
||||
@@ -357,6 +364,13 @@ test('auth gate falls back to password entry when login options request fails',
|
||||
await user.click(await screen.findByRole('button', { name: '进入作品' }));
|
||||
|
||||
const dialog = screen.getByRole('dialog', { name: '账号入口' });
|
||||
expect(within(dialog).getByRole('tab', { name: '短信登录' })).toBeTruthy();
|
||||
expect(within(dialog).getByRole('tab', { name: '密码登录' })).toBeTruthy();
|
||||
expect(within(dialog).getByLabelText('验证码')).toBeTruthy();
|
||||
expect(
|
||||
within(dialog).getByRole('button', { name: '获取验证码' }),
|
||||
).toBeTruthy();
|
||||
await user.click(within(dialog).getByRole('tab', { name: '密码登录' }));
|
||||
expect(within(dialog).getByLabelText('密码')).toBeTruthy();
|
||||
expect(within(dialog).queryByText('当前登录入口暂不可用。')).toBeNull();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user