feat: add the ability to make email optional (#994)

This commit is contained in:
Elias Schneider
2025-10-03 11:24:53 +02:00
committed by GitHub
parent 043cce615d
commit 507f9490fa
44 changed files with 175 additions and 69 deletions

View File

@@ -144,9 +144,13 @@ func (s *ApiKeyService) SendApiKeyExpiringSoonEmail(ctx context.Context, apiKey
}
}
if user.Email == nil {
return &common.UserEmailNotSetError{}
}
err := SendEmail(ctx, s.emailService, email.Address{
Name: user.FullName(),
Email: user.Email,
Email: *user.Email,
}, ApiKeyExpiringSoonTemplate, &ApiKeyExpiringSoonTemplateData{
ApiKeyName: apiKey.Name,
ExpiresAt: apiKey.ExpiresAt.ToTime(),