forked from baron/baron-sso
c489c7c3 기준 병합 code-check 오류 수정
This commit is contained in:
@@ -83,6 +83,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
String _verificationTitleKey = 'ui.userfront.login.verification.title';
|
||||
String _verificationPageTitleKey =
|
||||
'ui.userfront.login.verification.page_title';
|
||||
String _verificationActionLabelKey =
|
||||
'ui.userfront.login.verification.action_label';
|
||||
Timer? _verificationRedirectTimer;
|
||||
bool _noticeHandled = false;
|
||||
bool _drySendEnabled = false;
|
||||
@@ -142,7 +144,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
_markVerificationApproved(
|
||||
'msg.userfront.login.verification.approved_remote',
|
||||
titleKey: 'ui.userfront.login.verification.title_remote',
|
||||
onAction: _closeVerificationWindowIfPossible,
|
||||
actionLabelKey: 'ui.userfront.login.verification.action_label_remote',
|
||||
onAction: _moveToSigninOrCloseVerificationWindow,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -279,6 +282,12 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
}
|
||||
|
||||
Future<void> _tryCookieSession({bool silent = true}) async {
|
||||
if (AuthTokenStore.consumeSkipCookieSessionCheck()) {
|
||||
debugPrint(
|
||||
"[Auth] Skipping one cookie session check after verification handoff.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
final loginChallenge = _loginChallenge;
|
||||
final token = AuthTokenStore.getToken();
|
||||
if (!shouldPromoteCookieSession(
|
||||
@@ -798,7 +807,12 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
}
|
||||
final localeCode =
|
||||
extractLocaleFromPath(Uri.base) ?? resolvePreferredLocaleCode();
|
||||
webWindow.redirectTo(buildLocalizedVerificationCompletePath(localeCode));
|
||||
final target = buildLocalizedVerificationCompletePath(localeCode);
|
||||
if (mounted) {
|
||||
context.go(target);
|
||||
} else {
|
||||
webWindow.redirectTo(target);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -806,6 +820,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
String messageKey, {
|
||||
String? titleKey,
|
||||
String? pageTitleKey,
|
||||
String? actionLabelKey,
|
||||
String actionPath = '/',
|
||||
bool autoRedirect = false,
|
||||
Duration redirectDelay = const Duration(seconds: 2),
|
||||
@@ -822,6 +837,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
titleKey ?? 'ui.userfront.login.verification.title';
|
||||
_verificationPageTitleKey =
|
||||
pageTitleKey ?? 'ui.userfront.login.verification.page_title';
|
||||
_verificationActionLabelKey =
|
||||
actionLabelKey ?? 'ui.userfront.login.verification.action_label';
|
||||
_onVerificationAction = onAction;
|
||||
});
|
||||
_verificationRedirectTimer?.cancel();
|
||||
@@ -847,6 +864,15 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
webWindow.close();
|
||||
}
|
||||
|
||||
void _moveToSigninOrCloseVerificationWindow() {
|
||||
if (webWindow.hasOpener()) {
|
||||
webWindow.close();
|
||||
return;
|
||||
}
|
||||
AuthTokenStore.skipNextCookieSessionCheck();
|
||||
context.go(buildLocalizedSigninPath(Uri.base));
|
||||
}
|
||||
|
||||
void _handleVerificationResultPrimaryAction() {
|
||||
if (_onVerificationAction != null) {
|
||||
_runVerificationExitAction();
|
||||
@@ -875,7 +901,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
_markVerificationApproved(
|
||||
'msg.userfront.login.verification.approved_remote',
|
||||
titleKey: 'ui.userfront.login.verification.title_remote',
|
||||
onAction: _closeVerificationWindowIfPossible,
|
||||
actionLabelKey: 'ui.userfront.login.verification.action_label_remote',
|
||||
onAction: _moveToSigninOrCloseVerificationWindow,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -890,13 +917,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
);
|
||||
final verificationTitle = tr(_verificationTitleKey);
|
||||
final closeHint = tr('msg.userfront.login.verification.close_hint');
|
||||
final showCloseHint = _onVerificationAction != null || _verificationOnly;
|
||||
final actionLabelKey = showCloseHint
|
||||
? 'ui.userfront.login.verification.action_label_close'
|
||||
: 'ui.userfront.login.verification.action_label';
|
||||
final actionIcon = showCloseHint
|
||||
? Icons.close_rounded
|
||||
: Icons.arrow_forward_rounded;
|
||||
final showCloseHint =
|
||||
_verificationActionLabelKey ==
|
||||
'ui.userfront.login.verification.action_label_close';
|
||||
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
@@ -1001,11 +1024,13 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.icon(
|
||||
child: FilledButton(
|
||||
onPressed:
|
||||
_handleVerificationResultPrimaryAction,
|
||||
icon: Icon(actionIcon),
|
||||
label: Text(tr(actionLabelKey)),
|
||||
child: Text(
|
||||
tr(_verificationActionLabelKey),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1027,7 +1052,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
Wrap(
|
||||
const Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
@@ -1116,6 +1141,10 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
}
|
||||
|
||||
if (jwt is String && jwt.isNotEmpty) {
|
||||
if (_verificationOnly) {
|
||||
_markRemoteVerificationApproved();
|
||||
return;
|
||||
}
|
||||
if (hasLocalSession) {
|
||||
_markVerificationApproved(
|
||||
'msg.userfront.login.verification.approved_local',
|
||||
@@ -2367,7 +2396,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
const Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
|
||||
Reference in New Issue
Block a user