Skip to content

Commit

Permalink
Support non english languages for Signup errors
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Aug 7, 2023
1 parent 520b90c commit 2dea722
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/smooth_app/lib/pages/user_management/sign_up_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,23 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
_userFocusNode.requestFocus();
errorMessage = appLocalisations.sign_up_page_user_name_already_used;
} else {
errorMessage = status.error;
// Let's try to find the error in
final Iterable<RegExpMatch> allMatches =
RegExp('(<li class=\"error\">)(.*?)(</li>)')
.allMatches(status.error!);
if (allMatches.isNotEmpty) {
final StringBuffer buffer = StringBuffer();
for (final RegExpMatch match in allMatches) {
if (buffer.isNotEmpty) {
buffer.write('\n\n');
}

buffer.write(match.group(2));
}
errorMessage = buffer.toString();
} else {
errorMessage = status.error;
}
}
}

Expand Down

0 comments on commit 2dea722

Please sign in to comment.