From 2711e3443061bd2842c19a72ab8b78995b13fd97 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Wed, 23 Oct 2024 12:43:51 +0200 Subject: [PATCH 1/2] fix clippy error redundant clone --- gui/src/lianalite/login.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/lianalite/login.rs b/gui/src/lianalite/login.rs index 3016607c..e09d1028 100644 --- a/gui/src/lianalite/login.rs +++ b/gui/src/lianalite/login.rs @@ -128,7 +128,7 @@ impl LianaLiteLogin { Err(e) => ( Self { network, - datadir: datadir.clone(), + datadir, step: ConnectionStep::EnterEmail { email: form::Value::default(), }, @@ -142,7 +142,7 @@ impl LianaLiteLogin { Ok(auth_config) => ( Self { network, - datadir: datadir.clone(), + datadir, step: ConnectionStep::CheckingAuthFile, connection_error: None, wallet_id: auth_config.wallet_id.clone(), From e3ae1f369b32f5be542ce3df53cb652cc7be3b44 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Wed, 23 Oct 2024 12:53:43 +0200 Subject: [PATCH 2/2] Use signWithOtp method instead of the resend endpoint close #1385 --- gui/src/lianalite/client/auth.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/gui/src/lianalite/client/auth.rs b/gui/src/lianalite/client/auth.rs index 85c5767b..af7ef714 100644 --- a/gui/src/lianalite/client/auth.rs +++ b/gui/src/lianalite/client/auth.rs @@ -116,22 +116,13 @@ impl AuthClient { Ok(()) } - pub async fn resend_otp(&self) -> Result { - let response: Response = self - .request(Method::POST, &format!("{}/auth/v1/resend", self.url)) - .json(&ResendOtp { - email: &self.email, - kind: "signup", - }) - .send() - .await?; - if !response.status().is_success() { - return Err(AuthError { - http_status: Some(response.status().into()), - error: response.text().await?, - }); - } - Ok(response) + /// Resend method has to trigger a signInWithOTP method instead of using the resend endpoint. + /// The resend endpoint is used to resend an existing signup confirmation email, email change email, SMS OTP phone signup) + /// or phone change OTP. This method will only resend an email or phone OTP to the user if there was an initial signup, + /// email change or phone change request being made. + /// If we want to resend a passwordless sign-in OTP or Magic Link, we have to use the signInWithOtp() method again. + pub async fn resend_otp(&self) -> Result<(), AuthError> { + self.sign_in_otp().await } pub async fn verify_otp(&self, token: &str) -> Result {