Skip to content

Commit

Permalink
feat: Support non-english languages for Signup errors (#4474)
Browse files Browse the repository at this point in the history
* Support non english languages for Signup errors

* Hide warning
  • Loading branch information
g123k committed Aug 14, 2023
1 parent 544fe6b commit 023d8e5
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 @@ -376,7 +376,23 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
.contains(SignUpStatusError.SERVER_BUSY)) {
errorMessage = appLocalisations.sign_up_page_server_busy;
} 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 023d8e5

Please sign in to comment.