feat(frontend): add, list email

This commit is contained in:
sam 2024-10-02 02:46:39 +02:00
parent 5b17c716cb
commit e030342358
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
8 changed files with 273 additions and 9 deletions

View file

@ -197,10 +197,18 @@ public class EmailAuthController(
);
}
var validPassword = await authService.ValidatePasswordAsync(CurrentUser!, req.Password);
if (!validPassword)
if (emails.Count != 0)
{
throw new ApiError.Forbidden("Invalid password");
var validPassword = await authService.ValidatePasswordAsync(CurrentUser!, req.Password);
if (!validPassword)
{
throw new ApiError.Forbidden("Invalid password");
}
}
else
{
await authService.SetUserPasswordAsync(CurrentUser!, req.Password);
await db.SaveChangesAsync();
}
var state = await keyCacheService.GenerateRegisterEmailStateAsync(