forked from baron/baron-sso
fix(userfront): correctly display general signup errors in a dialog instead of password field
This commit is contained in:
@@ -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<SignupScreen> {
|
||||
_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<SignupScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void _showError(String message) {
|
||||
if (!mounted) return;
|
||||
ToastService.error(message);
|
||||
}
|
||||
|
||||
void _showSuccessDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
||||
Reference in New Issue
Block a user