feat: implement magic link sign in (#5036)

This commit is contained in:
Lucas.Xu
2024-04-11 16:33:28 +08:00
committed by GitHub
parent b7b4ea2da1
commit 1597f7d94c
81 changed files with 599 additions and 473 deletions

View File

@ -122,6 +122,23 @@ where
})
}
fn sign_in_with_magic_link(
&self,
email: &str,
redirect_to: &str,
) -> FutureResult<(), FlowyError> {
let email = email.to_owned();
let redirect_to = redirect_to.to_owned();
let try_get_client = self.server.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
client
.sign_in_with_magic_link(&email, Some(redirect_to))
.await?;
Ok(())
})
}
fn generate_oauth_url_with_provider(&self, provider: &str) -> FutureResult<String, FlowyError> {
let provider = AuthProvider::from(provider);
let try_get_client = self.server.try_get_client();

View File

@ -107,6 +107,16 @@ impl UserCloudService for LocalServerUserAuthServiceImpl {
})
}
fn sign_in_with_magic_link(
&self,
_email: &str,
_redirect_to: &str,
) -> FutureResult<(), FlowyError> {
FutureResult::new(async {
Err(FlowyError::local_version_not_support().with_context("Not support"))
})
}
fn generate_oauth_url_with_provider(&self, _provider: &str) -> FutureResult<String, FlowyError> {
FutureResult::new(async {
Err(FlowyError::internal().with_context("Can't oauth url when using offline mode"))

View File

@ -187,6 +187,18 @@ where
})
}
fn sign_in_with_magic_link(
&self,
_email: &str,
_redirect_to: &str,
) -> FutureResult<(), FlowyError> {
FutureResult::new(async {
Err(
FlowyError::not_support().with_context("Can't sign in with magic link when using supabase"),
)
})
}
fn generate_oauth_url_with_provider(&self, _provider: &str) -> FutureResult<String, FlowyError> {
FutureResult::new(async {
Err(FlowyError::internal().with_context("Can't generate oauth url when using supabase"))