From 5f64f5af12837315632de8d9a068da16e9c64a4c Mon Sep 17 00:00:00 2001 From: Phoebe Goldman Date: Thu, 3 Aug 2023 11:13:23 -0400 Subject: [PATCH] In identity recovery routes, use `IdentityForUrl` --- crates/client-api/src/routes/database.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/client-api/src/routes/database.rs b/crates/client-api/src/routes/database.rs index c717139623c..a9904de229b 100644 --- a/crates/client-api/src/routes/database.rs +++ b/crates/client-api/src/routes/database.rs @@ -31,6 +31,7 @@ use spacetimedb::identity::Identity; use spacetimedb::json::client_api::StmtResultJson; use spacetimedb::messages::control_db::{Database, DatabaseInstance, HostType}; +use super::identity::IdentityForUrl; use crate::util::{ByteStringBody, NameOrAddress}; use crate::{log_and_500, ControlCtx, ControlNodeDelegate, WorkerCtx}; @@ -640,13 +641,14 @@ pub struct RequestRecoveryCodeParams { #[serde(default)] link: bool, email: String, - identity: Identity, + identity: IdentityForUrl, } pub async fn request_recovery_code( State(ctx): State>, Query(RequestRecoveryCodeParams { link, email, identity }): Query, ) -> axum::response::Result { + let identity = Identity::from(identity); let Some(sendgrid) = ctx.sendgrid_controller() else { log::error!("A recovery code was requested, but SendGrid is disabled."); return Err((StatusCode::INTERNAL_SERVER_ERROR, "SendGrid is disabled.").into()); @@ -688,7 +690,7 @@ pub async fn request_recovery_code( #[derive(Deserialize)] pub struct ConfirmRecoveryCodeParams { pub email: String, - pub identity: Identity, + pub identity: IdentityForUrl, pub code: String, } @@ -700,6 +702,7 @@ pub async fn confirm_recovery_code( State(ctx): State>, Query(ConfirmRecoveryCodeParams { email, identity, code }): Query, ) -> axum::response::Result { + let identity = Identity::from(identity); let recovery_code = ctx .control_db() .spacetime_get_recovery_code(email.as_str(), code.as_str())