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 { 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(),