@@ -442,60 +442,60 @@ func (e *email) fromAuthConfig(remoteConfig v1API.AuthConfigResponse) {
442
442
if len (e .Template ) == 0 {
443
443
return
444
444
}
445
- var tmpl emailTemplate
446
- tmpl = e .Template ["invite" ]
447
- if tmpl .Subject != nil {
448
- tmpl .Subject = remoteConfig .MailerSubjectsInvite
449
- }
450
- if tmpl .Content != nil {
451
- tmpl .Content = remoteConfig .MailerTemplatesInviteContent
452
- }
453
- e .Template ["invite" ] = tmpl
454
-
455
- tmpl = e .Template ["confirmation" ]
456
- if tmpl .Subject != nil {
457
- tmpl .Subject = remoteConfig .MailerSubjectsConfirmation
458
- }
459
- if tmpl .Content != nil {
460
- tmpl .Content = remoteConfig .MailerTemplatesConfirmationContent
461
- }
462
- e .Template ["confirmation" ] = tmpl
463
-
464
- tmpl = e .Template ["recovery" ]
465
- if tmpl .Subject != nil {
466
- tmpl .Subject = remoteConfig .MailerSubjectsRecovery
467
- }
468
- if tmpl .Content != nil {
469
- tmpl .Content = remoteConfig .MailerTemplatesRecoveryContent
470
- }
471
- e .Template ["recovery" ] = tmpl
472
-
473
- tmpl = e .Template ["magic_link" ]
474
- if tmpl .Subject != nil {
475
- tmpl .Subject = remoteConfig .MailerSubjectsMagicLink
445
+ if t , ok := e .Template ["invite" ]; ok {
446
+ if t .Subject != nil {
447
+ t .Subject = remoteConfig .MailerSubjectsInvite
448
+ }
449
+ if t .Content != nil {
450
+ t .Content = remoteConfig .MailerTemplatesInviteContent
451
+ }
452
+ e .Template ["invite" ] = t
476
453
}
477
- if tmpl .Content != nil {
478
- tmpl .Content = remoteConfig .MailerTemplatesMagicLinkContent
454
+ if t , ok := e .Template ["confirmation" ]; ok {
455
+ if t .Subject != nil {
456
+ t .Subject = remoteConfig .MailerSubjectsConfirmation
457
+ }
458
+ if t .Content != nil {
459
+ t .Content = remoteConfig .MailerTemplatesConfirmationContent
460
+ }
461
+ e .Template ["confirmation" ] = t
479
462
}
480
- e .Template ["magic_link" ] = tmpl
481
-
482
- tmpl = e .Template ["email_change" ]
483
- if tmpl .Subject != nil {
484
- tmpl .Subject = remoteConfig .MailerSubjectsEmailChange
463
+ if t , ok := e .Template ["recovery" ]; ok {
464
+ if t .Subject != nil {
465
+ t .Subject = remoteConfig .MailerSubjectsRecovery
466
+ }
467
+ if t .Content != nil {
468
+ t .Content = remoteConfig .MailerTemplatesRecoveryContent
469
+ }
470
+ e .Template ["recovery" ] = t
485
471
}
486
- if tmpl .Content != nil {
487
- tmpl .Content = remoteConfig .MailerTemplatesEmailChangeContent
472
+ if t , ok := e .Template ["magic_link" ]; ok {
473
+ if t .Subject != nil {
474
+ t .Subject = remoteConfig .MailerSubjectsMagicLink
475
+ }
476
+ if t .Content != nil {
477
+ t .Content = remoteConfig .MailerTemplatesMagicLinkContent
478
+ }
479
+ e .Template ["magic_link" ] = t
488
480
}
489
- e .Template ["email_change" ] = tmpl
490
-
491
- tmpl = e .Template ["reauthentication" ]
492
- if tmpl .Subject != nil {
493
- tmpl .Subject = remoteConfig .MailerSubjectsReauthentication
481
+ if t , ok := e .Template ["email_change" ]; ok {
482
+ if t .Subject != nil {
483
+ t .Subject = remoteConfig .MailerSubjectsEmailChange
484
+ }
485
+ if t .Content != nil {
486
+ t .Content = remoteConfig .MailerTemplatesEmailChangeContent
487
+ }
488
+ e .Template ["email_change" ] = t
494
489
}
495
- if tmpl .Content != nil {
496
- tmpl .Content = remoteConfig .MailerTemplatesReauthenticationContent
490
+ if t , ok := e .Template ["reauthentication" ]; ok {
491
+ if t .Subject != nil {
492
+ t .Subject = remoteConfig .MailerSubjectsReauthentication
493
+ }
494
+ if t .Content != nil {
495
+ t .Content = remoteConfig .MailerTemplatesReauthenticationContent
496
+ }
497
+ e .Template ["reauthentication" ] = t
497
498
}
498
- e .Template ["reauthentication" ] = tmpl
499
499
}
500
500
501
501
func (s smtp ) IsEnabled () bool {
0 commit comments