-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Login: Allow logging in with social accounts #14082
Conversation
7e72fa3 mostly just adds a barely styled button, and enough code framework for things to run, but doesn't do much yet. 🙂 |
5e61fae
to
8d32aab
Compare
client/blocks/login/social.jsx
Outdated
} | ||
|
||
this.props.loginSocialUser( 'google', response.Zi.id_token ).then( () => { | ||
this.props.onSuccess( this.state ); |
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.
Sorry for my confusion, but what is this.state
?
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.
Good catch, some left over code from while I was messing around. I'll fix it.
8498c7b
to
4d27baa
Compare
Code looks good to me 👍 Thank you for working on that. I think we already removed the proxy check from the server side, so maybe we can drop that already? |
LGTM 👍 |
client/blocks/login/social.jsx
Outdated
constructor() { | ||
super(); | ||
|
||
this.handleGoogleResponse = this.handleGoogleResponse.bind( this ); |
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.
You can use arrow function style instead of binding.
handleGoogleResponse = ( response ) => { ... };
@@ -669,6 +669,9 @@ export const SITE_VOUCHERS_REQUEST_SUCCESS = 'SITE_VOUCHERS_REQUEST_SUCCESS'; | |||
export const SITE_WORDPRESS_UPDATE_REQUEST = 'SITE_WORDPRESS_UPDATE_REQUEST'; | |||
export const SITE_WORDPRESS_UPDATE_REQUEST_FAILURE = 'SITE_WORDPRESS_UPDATE_REQUEST_FAILURE'; | |||
export const SITE_WORDPRESS_UPDATE_REQUEST_SUCCESS = 'SITE_WORDPRESS_UPDATE_REQUEST_SUCCESS'; | |||
export const SOCIAL_LOGIN_REQUEST = 'SOCIAL_LOGIN_REQUEST'; |
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.
Do we plan to consume those action types? :) I assume, we do. I think that at least SOCIAL_LOGIN_REQUEST_FAILURE
is going to be useful to display error message when something goes wrong.
client/blocks/login/social.jsx
Outdated
|
||
export default connect( | ||
( state ) => ( { | ||
isRequesting: isRequesting( state ), |
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.
Those two props isRequesting
and requestError
are never consumed.
@pento do you plan to continue to work on this one or merge it as it is? |
@gziolo I addressed your comments, should be good to go now. |
client/blocks/login/index.jsx
Outdated
@@ -134,7 +134,7 @@ class Login extends Component { | |||
} | |||
|
|||
return ( | |||
<LoginForm onSuccess={ this.handleValidUsernamePassword } /> |
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.
We still need to call handleValidUsernamePassword
to ensure that users with 2FA enabled are redirected to the 2FA pages, otherwise it isn't possible to log in with a 2FA account.
(Requires new endpoint on WP.com that is currently not committed.)
856dda0
to
bc6aa71
Compare
I added a commit to fix 2FA and rebased. If you're cool with that (very minor) change, this LGTM. 👍 |
@@ -33,6 +36,7 @@ const loginErrorMessages = { | |||
unknown: translate( 'Invalid username or password.' ), | |||
account_unactivated: translate( 'This account has not been activated. Please check your email for an activation link.' ), | |||
sms_recovery_code_throttled: translate( 'You can only request a recovery code via SMS once per minute. Please wait and try again.' ), | |||
forbidden_for_automattician: 'Cannot use social login with an Automattician account', |
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.
I'm wondering (maybe for no good reason) if we really have to return an error that specific (could be just social_login_forbidden
with no mention about Automatticians).
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.
I don't see why we should not show this error to our fellow automatticians
This pull request addresses #14076 by adding a Google social login button, and associated login routines.
Testing instructions
git checkout add/14076-social-login
and start your server, or open a live branchLogin
pageReviews