fix(samples): replace login email with name#1272
Conversation
📝 WalkthroughWalkthroughThe login screen replaces email-based sign-up with a display-name entry flow. State fields switch from an email controller to a username controller with an error flag, ChangesDisplay Name Login Flow
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant LoginScreen
participant UserInfo
User->>LoginScreen: Enter display name, tap Continue
LoginScreen->>LoginScreen: _loginWithName()
alt Name is empty
LoginScreen->>LoginScreen: setState _userNameHasError = true
LoginScreen-->>User: Show error text
else Name provided
LoginScreen->>LoginScreen: setState _userNameHasError = false
LoginScreen->>UserInfo: createValidId(userName)
LoginScreen->>LoginScreen: _login(UserInfo)
end
Compact metadata:
🐰 A rabbit hops away from mail, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dogfooding/lib/screens/login_screen.dart`:
- Around line 66-73: The _loginWithName validation in login_screen.dart only
checks _userNameController.text with isEmpty, so whitespace-only input still
passes and later creates a blank-looking name/id via createValidId. Update
_loginWithName to trim the entered user name before validating and use the
trimmed value consistently for the error check and subsequent login flow. Keep
the fix localized around _loginWithName, _userNameController, and createValidId
so names containing only spaces are rejected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3257e163-ada9-480c-bf2d-a6feae35aa07
📒 Files selected for processing (1)
dogfooding/lib/screens/login_screen.dart
| Future<void> _loginWithName() async { | ||
| final userName = _userNameController.text; | ||
| if (userName.isEmpty) { | ||
| setState(() { | ||
| _userNameHasError = true; | ||
| }); | ||
| return debugPrint('User name is empty'); | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Whitespace-only name bypasses validation.
userName.isEmpty doesn't trim, so a name of only spaces passes validation but yields an all-underscore id (via createValidId) and a blank-looking display name.
🐛 Proposed fix
Future<void> _loginWithName() async {
- final userName = _userNameController.text;
+ final userName = _userNameController.text.trim();
if (userName.isEmpty) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Future<void> _loginWithName() async { | |
| final userName = _userNameController.text; | |
| if (userName.isEmpty) { | |
| setState(() { | |
| _userNameHasError = true; | |
| }); | |
| return debugPrint('User name is empty'); | |
| } | |
| Future<void> _loginWithName() async { | |
| final userName = _userNameController.text.trim(); | |
| if (userName.isEmpty) { | |
| setState(() { | |
| _userNameHasError = true; | |
| }); | |
| return debugPrint('User name is empty'); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@dogfooding/lib/screens/login_screen.dart` around lines 66 - 73, The
_loginWithName validation in login_screen.dart only checks
_userNameController.text with isEmpty, so whitespace-only input still passes and
later creates a blank-looking name/id via createValidId. Update _loginWithName
to trim the entered user name before validating and use the trimmed value
consistently for the error check and subsequent login flow. Keep the fix
localized around _loginWithName, _userNameController, and createValidId so names
containing only spaces are rejected.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1272 +/- ##
=======================================
Coverage 10.16% 10.16%
=======================================
Files 679 679
Lines 49765 49765
=======================================
Hits 5059 5059
Misses 44706 44706 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎯 Goal
The login screen is confusing for many people because of the login with email.
🛠 Implementation details
This replaces the email with a display name, how it's also actually working.
The React pronto app only asks the name later, but that would be a bigger change.
🎨 UI Changes
Add relevant screenshots
from pronto:

☑️Contributor Checklist
General
☑️Reviewer Checklist
Summary by CodeRabbit
New Features
Bug Fixes