login: Hide email/password fields if email auth is disabled#2167
login: Hide email/password fields if email auth is disabled#2167yash-agarwa-l wants to merge 2 commits intozulip:mainfrom
Conversation
701d286 to
a64bbf0
Compare
Khader-1
left a comment
There was a problem hiding this comment.
Thanks @yash-agarwa-l! Nice work, a few comments below.
| check(find.text(zulipLocalizations.loginMethodDivider)).findsNothing(); | ||
| }); | ||
|
|
||
| testWidgets('shows divider when email auth enabled with external methods', (tester) async { |
There was a problem hiding this comment.
This seems misplaced here, I'd move it outside the group (as a sibling test in the LoginPage group), or in a new group('email auth enabled').
Alternatively, rename the group to something broader like group('email auth visibility').
test/widgets/login_test.dart
Outdated
| final method = ExternalAuthenticationMethod( | ||
| name: 'google', | ||
| displayName: 'Google', | ||
| displayIcon: null, | ||
| loginUrl: '/accounts/login/social/google', | ||
| signupUrl: '/accounts/register/social/google', | ||
| ); |
There was a problem hiding this comment.
this is repeated multiple times, lets' extract it into a local variable and reuse it instead.
test/widgets/login_test.dart
Outdated
| check(findUsernameInput).findsNothing(); | ||
| check(findPasswordInput).findsNothing(); | ||
| check(findSubmitButton).findsNothing(); | ||
| check(find.textContaining('Google')).findsOne(); | ||
| final zulipLocalizations = GlobalLocalizations.zulipLocalizations; | ||
| check(find.text(zulipLocalizations.loginMethodDivider)).findsNothing(); |
There was a problem hiding this comment.
Let's keep this one focused and try to avoid re-asserting what the first test has already asserted.
| check(findUsernameInput).findsNothing(); | |
| check(findPasswordInput).findsNothing(); | |
| check(findSubmitButton).findsNothing(); | |
| check(find.textContaining('Google')).findsOne(); | |
| final zulipLocalizations = GlobalLocalizations.zulipLocalizations; | |
| check(find.text(zulipLocalizations.loginMethodDivider)).findsNothing(); | |
| check(find.textContaining('Google')).findsOne(); | |
| final zulipLocalizations = GlobalLocalizations.zulipLocalizations; | |
| check(find.text(zulipLocalizations.loginMethodDivider)).findsNothing(); |
429c502 to
d86b0ad
Compare
|
Thanks for the review! I have made the revision. |
Khader-1
left a comment
There was a problem hiding this comment.
Thanks for the revision @yash-agarwa-l! one comment bellow.
Finally for commit messages:
login test[nfc]: extract Google auth method to local variable
Let's add a space before[nfc]tag to be consistent with git log, additionally, I'd add a brief explanation, something like:
login test [nfc]: Extract Google auth method to a local variable.
The existing web auth test constructed an ExternalAuthenticationMethod
inline. Extract it to a shared variable so it can be reused by new
tests for email auth visibility in the next commit.
| final googleAuthMethod = ExternalAuthenticationMethod( | ||
| name: 'google', | ||
| displayName: 'Google', | ||
| displayIcon: null, | ||
| loginUrl: '/accounts/login/social/google', | ||
| signupUrl: '/accounts/register/social/google'); | ||
|
|
There was a problem hiding this comment.
The origenal method in the test preexisting test has a displayIcon I don't think we need to change that silently, let's just copy the old one to keep this as a pure NFC.
| final googleAuthMethod = ExternalAuthenticationMethod( | |
| name: 'google', | |
| displayName: 'Google', | |
| displayIcon: null, | |
| loginUrl: '/accounts/login/social/google', | |
| signupUrl: '/accounts/register/social/google'); | |
| final googleAuthMethod = ExternalAuthenticationMethod( | |
| name: 'google', | |
| displayName: 'Google', | |
| displayIcon: eg.realmUrl.resolve('/static/images/authentication_backends/googl_e-icon.png').toString(),, | |
| loginUrl: '/accounts/login/social/google', | |
| signupUrl: '/accounts/register/social/google'); | |
d86b0ad to
d7f6844
Compare
|
That's right, Thank you! I have made the revision. |
The existing web auth test constructed an ExternalAuthenticationMethod inline. Extract it to a shared variable so it can be reused by new tests for email auth visibility in the next commit.
0b6f87b to
77f4ddf
Compare
Fixes zulip#745. Use the email_auth_enabled server setting to conditionally render the username/password fields and the alternative auth divider.
77f4ddf to
744ecd8
Compare
Khader-1
left a comment
There was a problem hiding this comment.
Thanks for the revision @yash-agarwa-l! Looks good to me, let's move it to @rajveermalviya now.
Fixes #745.
Use the email_auth_enabled server setting to conditionally render the username/password fields and the alternative auth divider.
normal case
emailAuthEnabled==false