Skip to content

Commit 64fd268

Browse files
authored
In identity recovery routes, use IdentityForUrl (#139)
1 parent 6b0a6df commit 64fd268

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/client-api/src/routes/database.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use spacetimedb::identity::Identity;
3131
use spacetimedb::json::client_api::StmtResultJson;
3232
use spacetimedb::messages::control_db::{Database, DatabaseInstance, HostType};
3333

34+
use super::identity::IdentityForUrl;
3435
use crate::util::{ByteStringBody, NameOrAddress};
3536
use crate::{log_and_500, ControlCtx, ControlNodeDelegate, WorkerCtx};
3637

@@ -640,13 +641,14 @@ pub struct RequestRecoveryCodeParams {
640641
#[serde(default)]
641642
link: bool,
642643
email: String,
643-
identity: Identity,
644+
identity: IdentityForUrl,
644645
}
645646

646647
pub async fn request_recovery_code(
647648
State(ctx): State<Arc<dyn ControlCtx>>,
648649
Query(RequestRecoveryCodeParams { link, email, identity }): Query<RequestRecoveryCodeParams>,
649650
) -> axum::response::Result<impl IntoResponse> {
651+
let identity = Identity::from(identity);
650652
let Some(sendgrid) = ctx.sendgrid_controller() else {
651653
log::error!("A recovery code was requested, but SendGrid is disabled.");
652654
return Err((StatusCode::INTERNAL_SERVER_ERROR, "SendGrid is disabled.").into());
@@ -688,7 +690,7 @@ pub async fn request_recovery_code(
688690
#[derive(Deserialize)]
689691
pub struct ConfirmRecoveryCodeParams {
690692
pub email: String,
691-
pub identity: Identity,
693+
pub identity: IdentityForUrl,
692694
pub code: String,
693695
}
694696

@@ -700,6 +702,7 @@ pub async fn confirm_recovery_code(
700702
State(ctx): State<Arc<dyn ControlCtx>>,
701703
Query(ConfirmRecoveryCodeParams { email, identity, code }): Query<ConfirmRecoveryCodeParams>,
702704
) -> axum::response::Result<impl IntoResponse> {
705+
let identity = Identity::from(identity);
703706
let recovery_code = ctx
704707
.control_db()
705708
.spacetime_get_recovery_code(email.as_str(), code.as_str())

0 commit comments

Comments
 (0)