mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
fix: only add numbers if name taken
This commit is contained in:
parent
3767bbd6a9
commit
b919942705
@ -32,6 +32,7 @@ public class UserMiddleware
|
|||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
var displayName = context.User.Claims.FirstOrDefault(x=>x.Type==ClaimTypes.Name)?.Value ?? "Anonymous";
|
var displayName = context.User.Claims.FirstOrDefault(x=>x.Type==ClaimTypes.Name)?.Value ?? "Anonymous";
|
||||||
|
if(dbContext.Users.Any(x=>x.DisplayName==displayName))
|
||||||
displayName = $"{displayName}#{Guid.NewGuid().ToString().Substring(0, 4)}";
|
displayName = $"{displayName}#{Guid.NewGuid().ToString().Substring(0, 4)}";
|
||||||
user = new User
|
user = new User
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user