diff --git a/userfront/lib/features/auth/presentation/signup_screen.dart b/userfront/lib/features/auth/presentation/signup_screen.dart index d32673ca..20929ec4 100644 --- a/userfront/lib/features/auth/presentation/signup_screen.dart +++ b/userfront/lib/features/auth/presentation/signup_screen.dart @@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart'; import 'package:userfront/i18n.dart'; import '../../../core/i18n/locale_utils.dart'; import '../../../core/services/auth_proxy_service.dart'; +import '../../../core/ui/toast_service.dart'; class SignupScreen extends StatefulWidget { const SignupScreen({super.key}); @@ -336,16 +337,21 @@ class _SignupScreenState extends State { _passwordError = tr( 'msg.userfront.signup.password.lowercase_required', ); - } else if (eStr.contains('password') && (eStr.contains('digit') || eStr.contains('number'))) { + } else if (eStr.contains('password') && + (eStr.contains('digit') || eStr.contains('number'))) { _passwordError = tr('msg.userfront.signup.password.number_required'); - } else if (eStr.contains('password') && (eStr.contains('symbol') || eStr.contains('special'))) { + } else if (eStr.contains('password') && + (eStr.contains('symbol') || eStr.contains('special'))) { _passwordError = tr('msg.userfront.signup.password.symbol_required'); - } else if (eStr.contains('password') && (eStr.contains('length') || eStr.contains('12 characters'))) { + } else if (eStr.contains('password') && + (eStr.contains('length') || eStr.contains('12 characters'))) { _passwordError = tr('msg.userfront.signup.password.length_required'); } else { - _passwordError = tr( - 'msg.userfront.signup.failed', - params: {'error': e.toString()}, + _showError( + tr( + 'msg.userfront.signup.failed', + params: {'error': e.toString().replaceFirst('Exception: ', '')}, + ), ); } }); @@ -354,6 +360,11 @@ class _SignupScreenState extends State { } } + void _showError(String message) { + if (!mounted) return; + ToastService.error(message); + } + void _showSuccessDialog() { showDialog( context: context,