Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sign in with passcode #7685

Merged
merged 5 commits into from
Apr 10, 2025

Conversation

LucasXu0
Copy link
Collaborator

@LucasXu0 LucasXu0 commented Apr 4, 2025

Feature Preview

  • sign in with password
  • sign in with passcode
  • forgot password (another PR)
  • reset password (another PR)
  • new UI design in sign in page
  • new UI design in settings page

PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

@LucasXu0 LucasXu0 requested a review from Copilot April 4, 2025 06:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 23 out of 43 changed files in this pull request and generated no comments.

Files not reviewed (20)
  • frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart: Language not supported
  • frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/application/auth/af_cloud_auth_service.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/application/auth/auth_service.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/application/auth/backend_auth_service.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/application/user_service.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/mobile_sign_in_screen.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/anonymous_sign_in_button.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/anonymous_sign_in_button/anonymous_sign_in_button.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_email.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_email_and_password.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_magic_link_or_passcode_page.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_password.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_password_page.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/logo/logo.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/magic_link_sign_in_buttons.dart: Language not supported
  • frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/sign_in_agreement.dart: Language not supported

Copy link

sourcery-ai bot commented Apr 4, 2025

Reviewer's Guide by Sourcery

This pull request introduces the ability to sign in using a passcode, in addition to existing methods like email/password, OAuth, magic link, and guest access. The implementation spans across the frontend (Flutter) and backend (Rust) components, including UI changes, event handling, and service implementations.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added support for signing in with a passcode in addition to email and password, OAuth, magic link, and guest options.
  • Added signInWithPasscode event to SignInEvent.
  • Added _onSignInWithPasscode method to SignInBloc to handle the new event.
  • Modified SignInBloc to use GotrueTokenResponsePB instead of UserProfilePB for email/password and passcode sign-in methods.
  • Updated AppFlowyCloudDeepLink to handle GotrueTokenResponsePB and build deep link URI.
  • Added PasscodeSignInPB and GotrueTokenResponsePB protobuf messages.
  • Implemented sign_in_with_passcode_handler in flowy-user rust library.
  • Implemented sign_in_with_password and sign_in_with_passcode in flowy-server rust library.
  • Updated UserEvent enum in flowy-user rust library to include PasscodeSignIn.
  • Updated AuthService and its implementations to use GotrueTokenResponsePB for sign-in methods.
  • Added UI components for entering email and password/passcode.
frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/sign_in_anonymous_button.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/third_party_sign_in_button/third_party_sign_in_button.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/third_party_sign_in_button/third_party_sign_in_buttons.dart
frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
frontend/appflowy_flutter/lib/startup/tasks/app_widget.dart
frontend/rust-lib/flowy-user/src/entities/auth.rs
frontend/rust-lib/flowy-user/src/user_manager/manager.rs
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/sign_in_agreement.dart
frontend/appflowy_flutter/lib/user/presentation/widgets/flowy_logo_title.dart
frontend/rust-lib/flowy-user/src/event_handler.rs
frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
frontend/appflowy_flutter/lib/user/application/auth/af_cloud_auth_service.dart
frontend/appflowy_flutter/lib/user/application/auth/auth_service.dart
frontend/appflowy_flutter/lib/user/application/auth/backend_auth_service.dart
frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
frontend/rust-lib/flowy-server/src/local_server/impls/user.rs
frontend/rust-lib/flowy-server/src/supabase/api/user.rs
frontend/appflowy_flutter/lib/user/application/user_service.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/widgets.dart
frontend/rust-lib/flowy-user-pub/src/cloud.rs
frontend/rust-lib/flowy-user/src/event_map.rs
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/account_sign_in_out.dart
frontend/rust-lib/Cargo.toml
frontend/appflowy_flutter/pubspec.yaml
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/mobile_sign_in_screen.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/anonymous_sign_in_button.dart
frontend/appflowy_flutter/lib/user/presentation/widgets/auth_form_container.dart
frontend/appflowy_flutter/packages/appflowy_ui/README.md
frontend/appflowy_flutter/packages/appflowy_ui/lib/appflowy_ui.dart
frontend/appflowy_flutter/pubspec.lock
frontend/resources/translations/en.json
frontend/rust-lib/Cargo.lock
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_magic_link_or_passcode_page.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_password_page.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_email_and_password.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_email.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/continue_with/continue_with_password.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/logo/logo.dart
frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/anonymous_sign_in_button/anonymous_sign_in_button.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

github-actions bot commented Apr 4, 2025

🥷 Ninja i18n – 🛎️ Translations need to be updated

Project /project.inlang

lint rule new reports level link
Missing translation 290 warning contribute (via Fink 🐦)

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @LucasXu0 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The event names in SignInEvent should be more descriptive, for example, signInWithEmailAndPassword is better than signedInWithUserEmailAndPassword.
  • Consider grouping the sign-in methods and event handlers in SignInEvent using a sealed class or similar construct for better organization.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 73 to 82
void _pushContinueWithMagicLinkOrPasscodePage(
BuildContext context,
String email,
) {
if (!isEmail(email)) {
return showToastNotification(
context,
message: LocaleKeys.signIn_invalidEmail.tr(),
type: ToastificationType.error,
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Navigation logic in email continuation flow.

Before pushing the ContinueWithMagicLinkOrPasscodePage, a magic link event is dispatched. It would be good to ensure that any potential asynchronous outcomes (like network delays) are handled gracefully, so users don’t get confused if the deep-link isn’t immediately processed.

@LucasXu0 LucasXu0 marked this pull request as draft April 4, 2025 06:58
@LucasXu0 LucasXu0 marked this pull request as ready for review April 9, 2025 05:18
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. It looks like we've already reviewed the commit adbf5e6 in this pull request.

@LucasXu0 LucasXu0 force-pushed the sign_in_with_password_or_passcode branch 2 times, most recently from b22a347 to 4840f15 Compare April 10, 2025 02:42
@LucasXu0 LucasXu0 force-pushed the sign_in_with_password_or_passcode branch from 4840f15 to 0344afd Compare April 10, 2025 02:43
@LucasXu0 LucasXu0 force-pushed the sign_in_with_password_or_passcode branch from 250edcb to 6cc48e6 Compare April 10, 2025 05:17
@LucasXu0 LucasXu0 force-pushed the sign_in_with_password_or_passcode branch from 6cc48e6 to 4341102 Compare April 10, 2025 05:39
@LucasXu0 LucasXu0 changed the title feat: sign in with password or passcode feat: sign in with passcode Apr 10, 2025
@LucasXu0 LucasXu0 merged commit e3bbabd into AppFlowy-IO:main Apr 10, 2025
18 checks passed
LucasXu0 added a commit that referenced this pull request Apr 10, 2025
* feat: sign in with password or passcode

* feat: add loading dialog

* chore: update translations

* feat: support otp on mobile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant