-
Notifications
You must be signed in to change notification settings - Fork 47
Feature/register Support new account creation/registration #579
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
base: main
Are you sure you want to change the base?
Feature/register Support new account creation/registration #579
Conversation
## Summary Implemented a complete user registration flow for Matrix accounts with support for both password-based and SSO registration methods. ## Key Features - Full registration screen UI with modern design - Dual registration methods: - Password-based registration for custom homeservers - SSO registration via Google OAuth for matrix.org - Smart homeserver selection with automatic mode switching - Comprehensive form validation: - Username requirement checking - Password minimum length (8 characters) - Password confirmation matching - Custom homeserver URL validation - Registration status modal with real-time feedback - SSO state management synchronized with login screen - Clean error handling with user-friendly notifications ## Technical Implementation - Follows Element's approach: SSO flow shared between login and registration - Matrix server automatically handles account creation vs login based on OAuth identity - Integrated with existing authentication infrastructure - Consistent UX patterns with login screen - Simplified UIA handling (supports m.login.dummy flow) ## UI/UX Improvements - Clear visual feedback during registration process - Disabled button states to prevent duplicate submissions - Informative status messages during SSO flow - Responsive modal dialogs for registration status - Consistent styling with existing Robrix design language ## Testing Checklist - [x] Password registration with custom homeserver - [x] SSO registration with matrix.org - [x] Form validation (empty fields, password strength, confirmation) - [x] Modal display and dismissal - [x] Error handling and user notifications - [x] Button state management during async operations
- Use if-let instead of match for single pattern - Replace useless format! with to_string()
3a8c22c to
4ced188
Compare
…ling Major improvements to registration screen: 1. SSO Registration Support: - Added source-aware SSO handling with is_registration flag - Register and login screens now have independent action flows - Proper modal display during SSO authentication - Automatic modal updates with status messages 2. Modal Handling Fixes: - Fixed non-clickable Cancel/Abort buttons in registration modals - Implemented proper was_internal pattern for modal close events - Added button mask state (gray out) during processing - Correct modal text for password vs SSO registration 3. UI/UX Consistency: - Unified modal styles between login and register screens (285px width) - Consistent padding, spacing, colors (#CCC background) - Matching title sections and button styles - Unified outer screen styles (#FFF background) 4. Code Quality: - Simplified RegisterAction enum (removed redundant variants) - Complete decoupling between login and register SSO flows - Clear documentation of SSO action handling architecture - Fixed all layout and z-index issues Technical details: - SpawnSSOServer now includes is_registration flag - sliding_sync.rs sends appropriate actions based on source - Each screen only processes its own action types - Modal shows immediately on SSO button click for better UX
4ced188 to
6509e20
Compare
- Close registration modal after successful password registration Previously the modal remained invisible but active, blocking UI interactions - Prevent false offline notifications for normal sync states Only Error, Terminated, and Offline states now trigger connection error popups Idle and Running states are normal operational states This fixes issues where users would see incorrect error messages after registration when the sync service is actually working properly.
19d1220 to
e070f6f
Compare
Signed-off-by: Alvin <zyzzz0928@gmail.com>
Resolved conflicts in: - src/app.rs: Integrated register functionality with updated imports and view logic - src/home/main_desktop_ui.rs: Updated to use ids! macro - src/home/rooms_list_header.rs: Preserved enhanced offline state handling with ids! macro - src/sliding_sync.rs: Merged register support with new main features (link preview, tombstone)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive user registration feature for Matrix accounts, supporting both password-based registration for custom homeservers and SSO registration (via Google OAuth) for matrix.org. The implementation follows Element's approach where the SSO flow is shared between login and registration, with the Matrix server automatically determining whether to create a new account or log in an existing user.
Key Changes
- New registration screen with dual registration modes (password/SSO) and homeserver selection
- Registration logic with UIA (User-Interactive Authentication) handling for
m.login.dummyandm.login.registration_tokenflows - SSO flow enhancement to support both login and registration contexts with dedicated action types
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sliding_sync.rs | Adds register_user() function for password registration with UIA support, new MatrixRequest::Register variant, and enhances spawn_sso_server() to handle both login and registration |
| src/register/register_screen.rs | Complete registration UI with homeserver selection, form validation, password/SSO modes, and state management |
| src/register/register_status_modal.rs | Modal dialog for displaying registration progress with cancel functionality |
| src/register/mod.rs | Module definition for registration components |
| src/app.rs | Navigation handling between login/register screens and registration success flow |
| src/login/login_screen.rs | Replaces external signup URL with navigation to new register screen |
| src/lib.rs | Adds register module declaration |
| src/home/main_desktop_ui.rs | Adds state reset to prevent dock restoration issue |
| src/home/rooms_list_header.rs | Refines offline notification logic to avoid spurious error popups |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/sliding_sync.rs
Outdated
| // Don't save the session here - it will be saved when we convert to LoginBySSOSuccess | ||
| // This avoids duplicate session persistence |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Inconsistent comment: The comment on lines 337-338 states "Don't save the session here - it will be saved when we convert to LoginBySSOSuccess". However, this comment is placed in the password-based registration flow, not the SSO flow.
The password registration returns a client/session that gets passed to LoginBySSOSuccess on line 709, so the comment makes sense in context but could be clearer. Consider moving or clarifying this comment to explain that session persistence happens in the login flow that follows.
| // Don't save the session here - it will be saved when we convert to LoginBySSOSuccess | |
| // This avoids duplicate session persistence | |
| // Don't save the session here—session persistence is handled in the login flow that follows | |
| // (e.g., when passing to LoginBySSOSuccess). This avoids duplicate session persistence. |
Signed-off-by: Alvin <zyzzz0928@gmail.com>
|
State Transition: Registration → Login Background In the Matrix SDK, successful registration also means successful login. This is documented in https://docs.rs/matrix-sdk/0.16.0/matrix_sdk/authentication/matrix/struct.MatrixAuth.html#method.register and verified by The Challenge Robrix uses different action types for registration (RegisterAction) and login (LoginAction). After successful registration, we need to initialize all global state (CLIENT, SLIDING_SYNC, room lists, etc.) which is already Solution We reuse LoginBySSOSuccess to handle post-registration initialization: // After successful registration, trigger the login success flow Why LoginBySSOSuccess instead of LoginByPasswordResult?
Registration already authenticates us—we have a valid client and session. LoginBySSOSuccess simply:
The name LoginBySSOSuccess is somewhat misleading—it's effectively a "UseAuthenticatedClient" action that works for any pre-authenticated client (SSO, registration, restored session, etc.). |
Signed-off-by: Alvin <zyzzz0928@gmail.com>
…O cancel path Signed-off-by: Alvin <zyzzz0928@gmail.com>
…ancel, and reset state on navigate Signed-off-by: Alvin <zyzzz0928@gmail.com>
|
Hi @TigerInYourDream, just wanted to let you know that I did see this PR is ready for review, but it'll probably be a while before I can get to it due to the comparatively low priority of this feature. I do appreciate your work here though! in the meantime, can you fully prepare it for review by addressing all existing comments (marking the completed ones as resolved, and leaving replies/comments on the ones that aren't resolved yet), as well as fixing the conflicts? thanks. |
Resolved conflict in src/sliding_sync.rs by keeping both: - RegisterAction import from feature branch - AvatarState import from main branch
Hi @kevinaboos, Thanks for the update I completely understand the priority considerations. I've just resolved the merge conflicts with the latest main branch. I'll go through all the existing review comments now and:
The PR should be fully ready for review whenever you have time. No rush at all - I appreciate you taking the time to review this when you can. |
1. Improve URL validation in register screen - Use url::Url::parse() for proper URL validation - Support both full URLs and domain-only input - More robust than simple string prefix checking 2. Enhance registration token error detection - Check for both error message and M_INVALID_PARAM error code - Add clearer documentation about SDK limitations - More resilient to SDK error message changes
Remove duplicate modal closing and state reset when handling SSO registration success. The cleanup is now done only once in the RegistrationSuccess action handler, making the code flow clearer and avoiding potential state inconsistencies. Before: Cleanup happened twice (once when posting action, once when handling) After: Cleanup happens once in the centralized action handler
…brix into feature/register-new
Summary
Implemented a complete user registration flow for Matrix accounts with support for both password-based and SSO registration methods.
Key Features
Technical Implementation
UI/UX Improvements