forked from baron/baron-sso
fix userfront verify-only approval routing
This commit is contained in:
@@ -112,6 +112,19 @@ async function mockUserfrontApis(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
path.endsWith('/api/v1/auth/magic-link/verify') ||
|
||||||
|
path.endsWith('/api/v1/auth/login/code/verify') ||
|
||||||
|
path.endsWith('/api/v1/auth/login/code/verify-short')
|
||||||
|
) {
|
||||||
|
await route.fulfill({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify({ status: 'approved', pendingRef: 'e2e-approved' }),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await route.fulfill({
|
await route.fulfill({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -179,4 +192,24 @@ test.describe('UserFront WASM auth routing', () => {
|
|||||||
});
|
});
|
||||||
expect(approvedRef).toBe('e2e-approve-ref');
|
expect(approvedRef).toBe('e2e-approve-ref');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('verifyOnly 승인 완료 화면의 상단 액션은 signin으로 이동시키지 않는다', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await mockUserfrontApis(page, { sessionStatus: 401 });
|
||||||
|
|
||||||
|
await page.goto('/ko/l/AB123456');
|
||||||
|
|
||||||
|
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
||||||
|
await page.waitForTimeout(500);
|
||||||
|
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
||||||
|
|
||||||
|
await page.locator('flt-glass-pane').click({
|
||||||
|
position: { x: 30, y: 28 },
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
await page.waitForTimeout(300);
|
||||||
|
|
||||||
|
await expect(page).toHaveURL(/\/ko\/l\/AB123456$/);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -761,6 +761,10 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
|||||||
|
|
||||||
VoidCallback? _onVerificationAction;
|
VoidCallback? _onVerificationAction;
|
||||||
|
|
||||||
|
void _runVerificationExitAction() {
|
||||||
|
_onVerificationAction?.call();
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildVerificationResultView() {
|
Widget _buildVerificationResultView() {
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -794,7 +798,11 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
|||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_onVerificationAction != null) {
|
if (_onVerificationAction != null) {
|
||||||
_onVerificationAction!();
|
_runVerificationExitAction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_verificationOnly) {
|
||||||
|
webWindow.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final hasLocalSession =
|
final hasLocalSession =
|
||||||
@@ -1604,11 +1612,14 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
|||||||
if (_verificationOnly && _verificationApproved) {
|
if (_verificationOnly && _verificationApproved) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
title: Text(_verificationPageTitle),
|
title: Text(_verificationPageTitle),
|
||||||
leading: IconButton(
|
leading: _onVerificationAction == null
|
||||||
icon: const Icon(Icons.arrow_back),
|
? null
|
||||||
onPressed: () => context.go(buildLocalizedHomePath(Uri.base)),
|
: IconButton(
|
||||||
),
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: _runVerificationExitAction,
|
||||||
|
),
|
||||||
actions: const [ThemeToggleButton(compact: true)],
|
actions: const [ThemeToggleButton(compact: true)],
|
||||||
),
|
),
|
||||||
body: _buildVerificationResultView(),
|
body: _buildVerificationResultView(),
|
||||||
|
|||||||
Reference in New Issue
Block a user