Refactor password handling in EmailAccountDto

Replaced the `EncryptedPassword` property in `EmailAccountDto` with `Password` and `PasswordEncrypted` to support both plain text and encrypted passwords. Updated `LimilabsEmailService` to use the new properties, checking the `PasswordEncrypted` flag to determine whether decryption is needed.
This commit is contained in:
2026-07-23 13:31:27 +02:00
parent 3e04fd7b63
commit 851a4e94f9
2 changed files with 5 additions and 2 deletions

View File

@@ -7,7 +7,9 @@ public class EmailAccountDto
{
public string Username { get; set; } = null!;
public string? EncryptedPassword { get; set; }
public string Password { get; set; } = null!;
public bool PasswordEncrypted { get; set; } = false;
public string SmtpServer { get; set; } = null!;

View File

@@ -91,7 +91,8 @@ public class LimilabsEmailService(
}
else
{
var password = encryptionService.Decrypt(_smtpAccount.EncryptedPassword!);
var password = _smtpAccount.PasswordEncrypted ? encryptionService.Decrypt(_smtpAccount.Password) : _smtpAccount.Password;
smtp.Login(_smtpAccount.Username, password);
}