register missing push devices at login (#3792)

save the push token of new device even if push notifications are not
enabled and provide a way to register the push device at login

unregister device if there already is a push token saved unless the
new token has already been registered.

also the `unregister_push_device` function used the wrong argument
cf. 08d380900b/src/Core/Services/Implementations/RelayPushRegistrationService.cs (L43)
This commit is contained in:
Stefan Melmuk
2024-01-30 19:14:25 +01:00
committed by GitHub
parent 4b9384cb2b
commit 3b283c289e
5 changed files with 60 additions and 21 deletions

View File

@@ -14,6 +14,7 @@ use crate::{
log_user_event,
two_factor::{authenticator, duo, email, enforce_2fa_policy, webauthn, yubikey},
},
push::register_push_device,
ApiResult, EmptyResult, JsonResult, JsonUpcase,
},
auth::{generate_organization_api_key_login_claims, ClientHeaders, ClientIp},
@@ -266,6 +267,9 @@ async fn _password_login(
}
}
// register push device
register_push_device(&mut device, conn).await?;
// Common
// ---
// Disabled this variable, it was used to generate the JWT