heyoka955
heyoka955
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
Solved it UserName was not same as email but do not know why it need it?
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
?
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
are there keywords to look for?
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
how can i find it at asiest? We have identityServer, our backend, IdneityManager
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
but the login is in angular
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
takes lil bit
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
i look for it
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
the login i send
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
if you do find something then tell me
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
i did not show the whole code because the is the most important part
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
public async Task<IActionResult> RegisterWebshopUser(WebshopUserDto webshopUser)
{
try
{
var existingUser = await this.UserManager.FindByEmailAsync(webshopUser.Email);

if (existingUser == null)
{
var user = new ApplicationUser
{
UserName = webshopUser.First + webshopUser.Last,
Email = webshopUser.Email,
RegisteredOn = DateTime.Now,
NeedToChangePassword = false,
UserType = UserTypes.WebUser,
EmailConfirmed = true,
IsEnabled = true
};
var result = await this.UserManager.CreateAsync(user, webshopUser.Password);

if (result.Succeeded)
{
await this.UserManager.AddClaimsAsync(user, new[]
{
new Claim(JwtClaimTypes.FamilyName, webshopUser.Last),
new Claim(JwtClaimTypes.GivenName, webshopUser.First)
});

}
var newUser = await this.UserManager.FindByEmailAsync(webshopUser.Email);
return Created("User created", newUser);
}
//
}
public async Task<IActionResult> RegisterWebshopUser(WebshopUserDto webshopUser)
{
try
{
var existingUser = await this.UserManager.FindByEmailAsync(webshopUser.Email);

if (existingUser == null)
{
var user = new ApplicationUser
{
UserName = webshopUser.First + webshopUser.Last,
Email = webshopUser.Email,
RegisteredOn = DateTime.Now,
NeedToChangePassword = false,
UserType = UserTypes.WebUser,
EmailConfirmed = true,
IsEnabled = true
};
var result = await this.UserManager.CreateAsync(user, webshopUser.Password);

if (result.Succeeded)
{
await this.UserManager.AddClaimsAsync(user, new[]
{
new Claim(JwtClaimTypes.FamilyName, webshopUser.Last),
new Claim(JwtClaimTypes.GivenName, webshopUser.First)
});

}
var newUser = await this.UserManager.FindByEmailAsync(webshopUser.Email);
return Created("User created", newUser);
}
//
}
20 replies
CC#
Created by heyoka955 on 10/17/2024 in #help
identity server cannot login even data is saved in the database
which part of it? how the user is saved in the database?
20 replies