Merge #1395: Fix lianalite resend token
e3ae1f369b32f5be542ce3df53cb652cc7be3b44 Use signWithOtp method instead of the resend endpoint (edouardparis) 2711e3443061bd2842c19a72ab8b78995b13fd97 fix clippy error redundant clone (edouardparis) Pull request description: close https://github.com/wizardsardine/liana/issues/1385 ACKs for top commit: edouardparis: Self-ACK e3ae1f369b32f5be542ce3df53cb652cc7be3b44 Tree-SHA512: 12a6ee2ace8c44113e54ca821ff5e3b08236c4e2f272ea04c5eeb4eaddf496575029410c5050365fbda49200613a4385cb24905c8eb9073e76fe36d78eb4fa2a
This commit is contained in:
commit
2d772d3b0c
@ -116,22 +116,13 @@ impl AuthClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn resend_otp(&self) -> Result<Response, AuthError> {
|
||||
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<AccessTokenResponse, AuthError> {
|
||||
|
||||
@ -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(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user