include branding and user in context
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
7d9b66b6e6
commit
07ea6f9dee
|
@ -172,11 +172,13 @@ class MobileTransaction(ExpiringModel):
|
||||||
|
|
||||||
def send_message(self, request: HttpRequest, **context):
|
def send_message(self, request: HttpRequest, **context):
|
||||||
"""Send mobile message"""
|
"""Send mobile message"""
|
||||||
branding = request.tenant.branding_title
|
|
||||||
domain = request.get_host()
|
domain = request.get_host()
|
||||||
user: User = self.device.user
|
user: User = self.device.user
|
||||||
client_ip = ClientIPMiddleware.get_client_ip(request)
|
client_ip = ClientIPMiddleware.get_client_ip(request)
|
||||||
|
|
||||||
|
context["_brand"] = request.tenant.branding_title
|
||||||
|
context["_user"] = user.username
|
||||||
|
|
||||||
geo = None
|
geo = None
|
||||||
if GEOIP_CONTEXT_PROCESSOR.configured():
|
if GEOIP_CONTEXT_PROCESSOR.configured():
|
||||||
city = GEOIP_CONTEXT_PROCESSOR.city(client_ip)
|
city = GEOIP_CONTEXT_PROCESSOR.city(client_ip)
|
||||||
|
@ -191,7 +193,7 @@ class MobileTransaction(ExpiringModel):
|
||||||
items=self.decision_items,
|
items=self.decision_items,
|
||||||
mode=self.device.stage.item_matching_mode,
|
mode=self.device.stage.item_matching_mode,
|
||||||
attributes=AuthenticationRequest.Attributes(
|
attributes=AuthenticationRequest.Attributes(
|
||||||
title=__("%(brand)s authentication request" % {"brand": branding}),
|
title=__("Authentication request"),
|
||||||
body=__(
|
body=__(
|
||||||
"%(user)s is attempting to log in to %(domain)s"
|
"%(user)s is attempting to log in to %(domain)s"
|
||||||
% {
|
% {
|
||||||
|
|
Reference in New Issue