From d9c282fcf8df313dfa88c45b74400ab3282eb7ea Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Sun, 5 Apr 2026 11:36:15 +0500 Subject: [PATCH] identity: replace account already exists errors on signup with one message (#90) --- Streetwriters.Identity/Services/UserAccountService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Streetwriters.Identity/Services/UserAccountService.cs b/Streetwriters.Identity/Services/UserAccountService.cs index 059cf3b..42e452d 100644 --- a/Streetwriters.Identity/Services/UserAccountService.cs +++ b/Streetwriters.Identity/Services/UserAccountService.cs @@ -185,7 +185,14 @@ namespace Streetwriters.Identity.Services }; } - return SignupResponse.Error(result.Errors.ToErrors()); + var otherErrors = result.Errors + .Where(e => e.Code != "DuplicateUserName" && e.Code != "DuplicateEmail") + .ToErrors(); + var hasDuplicate = result.Errors.Any(e => e.Code == "DuplicateUserName" || e.Code == "DuplicateEmail"); + var errors = hasDuplicate + ? ["Unable to create an account on this email.", .. otherErrors] + : otherErrors; + return SignupResponse.Error(errors); } catch (System.Exception ex) {