unique email handling
This commit is contained in:
parent
229971783a
commit
10fdcb288c
1 changed files with 4 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ using IdentityModel;
|
||||||
using Yavsc.Server.Helpers;
|
using Yavsc.Server.Helpers;
|
||||||
using Microsoft.AspNetCore.Mvc.Localization;
|
using Microsoft.AspNetCore.Mvc.Localization;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Data.Common;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -538,9 +539,9 @@ IHtmlLocalizerFactory htmlLocalizerFactory,
|
||||||
{
|
{
|
||||||
for (var current = exception; current is not null; current = current.InnerException)
|
for (var current = exception; current is not null; current = current.InnerException)
|
||||||
{
|
{
|
||||||
if (current is PostgresException pg
|
if (current is DbException pg
|
||||||
&& pg.SqlState == PostgresErrorCodes.UniqueViolation
|
&& pg.ErrorCode == 23505)
|
||||||
&& string.Equals(pg.ConstraintName, "AK_AspNetUsers_Email", StringComparison.Ordinal))
|
// UNIQUE VIOLATION https://www.postgresql.org/docs/8.4/errcodes-appendix.html
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue