fix more stuff

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-09-04 18:25:08 +02:00
parent 444ea83653
commit cb6d4f9b27
No known key found for this signature in database
3 changed files with 10 additions and 4 deletions

View File

@ -121,8 +121,13 @@ class MobileDevice(SerializerModel, Device):
notification=AndroidNotification(icon="stock_ticker_update", color="#f45342"), notification=AndroidNotification(icon="stock_ticker_update", color="#f45342"),
), ),
apns=APNSConfig( apns=APNSConfig(
headers={"apns-push-type": "alert", "apns-priority": "10"},
payload=APNSPayload( payload=APNSPayload(
aps=Aps(badge=0), aps=Aps(
badge=0,
sound="default",
content_available=True,
),
interruption_level="time-sensitive", interruption_level="time-sensitive",
), ),
), ),
@ -133,6 +138,7 @@ class MobileDevice(SerializerModel, Device):
LOGGER.debug("Sent notification", id=response) LOGGER.debug("Sent notification", id=response)
except (ValueError, FirebaseError) as exc: except (ValueError, FirebaseError) as exc:
LOGGER.warning("failed to push", exc=exc) LOGGER.warning("failed to push", exc=exc)
return True
def __str__(self): def __str__(self):
return str(self.name) or str(self.user) return str(self.name) or str(self.user)

View File

@ -193,9 +193,9 @@ def validate_challenge_mobile(device_pk: str, stage_view: StageView, user: User)
).name ).name
try: try:
response = device.send_message(**push_context) response = device.send_message(stage_view.request, **push_context)
# {'result': 'allow', 'status': 'allow', 'status_msg': 'Success. Logging you in...'} # {'result': 'allow', 'status': 'allow', 'status_msg': 'Success. Logging you in...'}
if response["result"] == "deny": if not response:
LOGGER.debug("mobile push response", result=response) LOGGER.debug("mobile push response", result=response)
login_failed.send( login_failed.send(
sender=__name__, sender=__name__,

View File

@ -197,7 +197,7 @@ class AuthenticatorValidateStageView(ChallengeStageView):
challenge = DeviceChallenge( challenge = DeviceChallenge(
data={ data={
"device_class": device_class, "device_class": device_class,
"device_uid": device.pk, "device_uid": str(device.pk),
"challenge": get_challenge_for_device(self.request, stage, device), "challenge": get_challenge_for_device(self.request, stage, device),
} }
) )