stages/email: fix path for email icon
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
8c6aaf4a2d
commit
263d9128c4
|
@ -1,6 +1,7 @@
|
||||||
"""email utils"""
|
"""email utils"""
|
||||||
from email.mime.image import MIMEImage
|
from email.mime.image import MIMEImage
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from django.core.mail import EmailMultiAlternatives
|
from django.core.mail import EmailMultiAlternatives
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
@ -10,7 +11,10 @@ from django.utils import translation
|
||||||
@lru_cache()
|
@lru_cache()
|
||||||
def logo_data():
|
def logo_data():
|
||||||
"""Get logo as MIME Image for emails"""
|
"""Get logo as MIME Image for emails"""
|
||||||
with open("web/icons/icon_left_brand.png", "rb") as _logo_file:
|
path = Path("web/icons/icon_left_brand.png")
|
||||||
|
if not path.exists():
|
||||||
|
path = Path("web/dist/assets/icons/icon_left_brand.png")
|
||||||
|
with open(path, "rb") as _logo_file:
|
||||||
logo = MIMEImage(_logo_file.read())
|
logo = MIMEImage(_logo_file.read())
|
||||||
logo.add_header("Content-ID", "logo.png")
|
logo.add_header("Content-ID", "logo.png")
|
||||||
return logo
|
return logo
|
||||||
|
|
Reference in New Issue