1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-04 02:18:00 +01:00

Merge branch 'BlackDex-add-knowndevice-endpoint'

Dieser Commit ist enthalten in:
Daniel García 2022-11-09 22:37:53 +01:00
Commit bdc1cd13a7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A

Datei anzeigen

@ -36,6 +36,7 @@ pub fn routes() -> Vec<rocket::Route> {
verify_password,
api_key,
rotate_api_key,
get_known_device,
]
}
@ -739,3 +740,16 @@ async fn api_key(data: JsonUpcase<SecretVerificationRequest>, headers: Headers,
async fn rotate_api_key(data: JsonUpcase<SecretVerificationRequest>, headers: Headers, conn: DbConn) -> JsonResult {
_api_key(data, true, headers, conn).await
}
#[get("/devices/knowndevice/<email>/<uuid>")]
async fn get_known_device(email: String, uuid: String, mut conn: DbConn) -> String {
// This endpoint doesn't have auth header
if let Some(user) = User::find_by_mail(&email, &mut conn).await {
match Device::find_by_uuid_and_user(&uuid, &user.uuid, &mut conn).await {
Some(_) => String::from("true"),
_ => String::from("false"),
}
} else {
String::from("false")
}
}