mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: implement magic link sign in (#5036)
This commit is contained in:
@ -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();
|
||||
|
@ -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"))
|
||||
|
@ -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"))
|
||||
|
Reference in New Issue
Block a user