forked from baron/baron-sso
feat(i18n): apply ORY bypass whitelist policy and add error-code tests
This commit is contained in:
@@ -24,10 +24,13 @@ class ErrorScreen extends StatelessWidget {
|
||||
final isProd = isProdOverride ?? AuthProxyService.isProdEnv;
|
||||
final normalizedCode = (errorCode ?? '').trim();
|
||||
final hasCode = normalizedCode.isNotEmpty;
|
||||
final whitelistFallback = errorWhitelistMessages[normalizedCode];
|
||||
final isWhitelisted = whitelistFallback != null;
|
||||
final internalWhitelistFallback =
|
||||
internalErrorWhitelistMessages[normalizedCode];
|
||||
final isInternalWhitelisted = internalWhitelistFallback != null;
|
||||
final isOryBypass = hasCode && oryBypassErrorCodes.contains(normalizedCode);
|
||||
final isKnownProdCode = hasCode && (isInternalWhitelisted || isOryBypass);
|
||||
final errorType = isProd
|
||||
? (isWhitelisted && hasCode ? normalizedCode : 'unknown_error')
|
||||
? (isKnownProdCode ? normalizedCode : 'unknown_error')
|
||||
: (hasCode ? normalizedCode : 'unknown_error');
|
||||
final title = isProd
|
||||
? tr('msg.userfront.error.title')
|
||||
@@ -40,14 +43,22 @@ class ErrorScreen extends StatelessWidget {
|
||||
'msg.userfront.error.title_generic',
|
||||
));
|
||||
final detail = isProd
|
||||
? (isWhitelisted
|
||||
? (isInternalWhitelisted
|
||||
? tr(
|
||||
'msg.userfront.error.whitelist.$normalizedCode',
|
||||
fallback: whitelistFallback,
|
||||
fallback: internalWhitelistFallback,
|
||||
)
|
||||
: tr(
|
||||
'msg.userfront.error.detail_contact',
|
||||
))
|
||||
: (isOryBypass
|
||||
? tr(
|
||||
'msg.userfront.error.ory.$normalizedCode',
|
||||
fallback:
|
||||
(description?.isNotEmpty == true)
|
||||
? description
|
||||
: tr('msg.userfront.error.detail_request'),
|
||||
)
|
||||
: tr(
|
||||
'msg.userfront.error.detail_contact',
|
||||
)))
|
||||
: ((description?.isNotEmpty == true)
|
||||
? description!
|
||||
: (hasCode
|
||||
|
||||
Reference in New Issue
Block a user