@@ -31,6 +31,7 @@ use spacetimedb::identity::Identity;
3131use spacetimedb:: json:: client_api:: StmtResultJson ;
3232use spacetimedb:: messages:: control_db:: { Database , DatabaseInstance , HostType } ;
3333
34+ use super :: identity:: IdentityForUrl ;
3435use crate :: util:: { ByteStringBody , NameOrAddress } ;
3536use 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
646647pub 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 ) ]
689691pub 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