File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -490,7 +490,7 @@ class _UsernamePasswordFormState extends State<_UsernamePasswordForm> {
490
490
if (! usernameValid || ! passwordValid) {
491
491
return ;
492
492
}
493
- final String username = usernameFieldState.value! ;
493
+ final String username = usernameFieldState.value! . trim () ;
494
494
final String password = passwordFieldState.value! ;
495
495
496
496
widget.loginPageState.setState (() {
Original file line number Diff line number Diff line change @@ -135,6 +135,26 @@ void main() {
135
135
id: testBinding.globalStore.accounts.single.id));
136
136
});
137
137
138
+ testWidgets ('trims whitespace on username' , (tester) async {
139
+ final serverSettings = eg.serverSettings ();
140
+ await prepare (tester, serverSettings);
141
+ check (testBinding.globalStore.accounts).isEmpty ();
142
+
143
+ await tester.enterText (findUsernameInput, ' ${eg .selfAccount .email } ' );
144
+ await tester.enterText (findPasswordInput, 'p455w0rd' );
145
+ connection.prepare (json: FetchApiKeyResult (
146
+ apiKey: eg.selfAccount.apiKey,
147
+ email: eg.selfAccount.email,
148
+ userId: eg.selfAccount.userId,
149
+ ).toJson ());
150
+ await tester.tap (findSubmitButton);
151
+ checkFetchApiKey (username: eg.selfAccount.email, password: 'p455w0rd' );
152
+ await tester.idle ();
153
+ check (testBinding.globalStore.accounts).single
154
+ .equals (eg.selfAccount.copyWith (
155
+ id: testBinding.globalStore.accounts.single.id));
156
+ });
157
+
138
158
testWidgets ('account already exists' , (tester) async {
139
159
final serverSettings = eg.serverSettings ();
140
160
await prepare (tester, serverSettings);
You can’t perform that action at this time.
0 commit comments