1
0
forked from baron/baron-sso

Merge feature/i18n into dev (userfront only)

This commit is contained in:
Lectom C Han
2026-02-12 21:53:42 +09:00
55 changed files with 3982 additions and 1104 deletions

View File

@@ -11,11 +11,25 @@ class AuthProxyService {
if (!dotenv.isInitialized) {
return fallback;
}
return dotenv.env[key] ?? fallback;
final value = dotenv.env[key];
if (value == null || value.trim().isEmpty) {
return fallback;
}
return value;
}
static String _fallbackOrigin() {
try {
final origin = Uri.base.origin;
if (origin.isNotEmpty && origin != 'null') {
return origin;
}
} catch (_) {}
return 'http://sso.hmac.kr';
}
static String get _baseUrl {
final rawUrl = _envOrDefault('BACKEND_URL', 'https://sso.hmac.kr');
final rawUrl = _envOrDefault('BACKEND_URL', _fallbackOrigin());
// 배포 환경에서 $ 기호나 공백이 섞여 들어오는 경우를 방지하기 위해 정제합니다.
return rawUrl.replaceAll(r'$', '').trim().replaceAll(RegExp(r'/$'), '');
}
@@ -103,7 +117,7 @@ class AuthProxyService {
bool? drySend,
}) async {
final url = Uri.parse('$_baseUrl/api/v1/auth/enchanted-link/init');
final userfrontUrl = _envOrDefault('USERFRONT_URL', 'http://sso.hmac.kr');
final userfrontUrl = _envOrDefault('USERFRONT_URL', _fallbackOrigin());
final body = <String, dynamic>{'loginId': loginId, 'uri': userfrontUrl};
if (_shouldSendDrySend(drySend)) {
@@ -269,7 +283,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.login_failed',
fallback: '로그인에 실패했습니다.',
),
);
}
@@ -294,7 +307,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.consent_fetch',
fallback: '동의 정보를 가져오지 못했습니다.',
),
);
}
@@ -324,7 +336,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.consent_accept',
fallback: '동의 처리에 실패했습니다.',
),
);
}
@@ -350,7 +361,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.consent_reject',
fallback: '동의 거부에 실패했습니다.',
),
);
}
@@ -381,7 +391,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.oidc_accept',
fallback: 'OIDC 로그인 승인에 실패했습니다.',
),
);
}
@@ -412,7 +421,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.password_reset_init',
fallback: '비밀번호 재설정을 시작하지 못했습니다.',
),
);
}
@@ -447,7 +455,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.password_reset_complete',
fallback: '비밀번호 재설정에 실패했습니다.',
),
);
}
@@ -780,7 +787,6 @@ class AuthProxyService {
errorBody['error'] ??
tr(
'err.userfront.auth_proxy.linked_app_revoke',
fallback: '연동 해지에 실패했습니다.',
),
);
}

View File

@@ -1,4 +1,6 @@
class WebWindow {
void setTitle(String title) {}
void redirectTo(String url) {}
void alert(String message) {}

View File

@@ -3,6 +3,10 @@
import 'dart:html' as html;
class WebWindow {
void setTitle(String title) {
html.document.title = title;
}
void redirectTo(String url) {
html.window.location.href = url;
}