Adds profile and settings pages
This commit is contained in:
@@ -77,6 +77,19 @@ public class AuthService : IAuthService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ChangePasswordAsync(Guid userId, string currentPassword, string newPassword)
|
||||
{
|
||||
var user = await _userManager.FindByIdAsync(userId.ToString())
|
||||
?? throw new UnauthorizedException("Gebruiker niet gevonden.");
|
||||
|
||||
var result = await _userManager.ChangePasswordAsync(user, currentPassword, newPassword);
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
var errors = string.Join(", ", result.Errors.Select(e => e.Description));
|
||||
throw new ValidationException(errors);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<TokenResponse> GenerateTokenResponseAsync(ApplicationUser user)
|
||||
{
|
||||
var roles = await _userManager.GetRolesAsync(user);
|
||||
|
||||
Reference in New Issue
Block a user