include branding and user in context

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2024-01-03 14:08:55 +01:00
parent 7d9b66b6e6
commit 07ea6f9dee
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -172,11 +172,13 @@ class MobileTransaction(ExpiringModel):
def send_message(self, request: HttpRequest, **context):
"""Send mobile message"""
branding = request.tenant.branding_title
domain = request.get_host()
user: User = self.device.user
client_ip = ClientIPMiddleware.get_client_ip(request)
context["_brand"] = request.tenant.branding_title
context["_user"] = user.username
geo = None
if GEOIP_CONTEXT_PROCESSOR.configured():
city = GEOIP_CONTEXT_PROCESSOR.city(client_ip)
@ -191,7 +193,7 @@ class MobileTransaction(ExpiringModel):
items=self.decision_items,
mode=self.device.stage.item_matching_mode,
attributes=AuthenticationRequest.Attributes(
title=__("%(brand)s authentication request" % {"brand": branding}),
title=__("Authentication request"),
body=__(
"%(user)s is attempting to log in to %(domain)s"
% {