stages/email: fix path for email icon
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -1,6 +1,7 @@
 | 
			
		||||
"""email utils"""
 | 
			
		||||
from email.mime.image import MIMEImage
 | 
			
		||||
from functools import lru_cache
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
 | 
			
		||||
from django.core.mail import EmailMultiAlternatives
 | 
			
		||||
from django.template.loader import render_to_string
 | 
			
		||||
@ -10,7 +11,10 @@ from django.utils import translation
 | 
			
		||||
@lru_cache()
 | 
			
		||||
def logo_data():
 | 
			
		||||
    """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.add_header("Content-ID", "logo.png")
 | 
			
		||||
    return logo
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user