Skip to content
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

Merged
merged 10 commits into from
May 19, 2017
Merged

Conversation

pento
Copy link
Contributor

@pento pento commented May 16, 2017

This pull request addresses #14076 by adding a Google social login button, and associated login routines.

Testing instructions

  1. Run git checkout add/14076-social-login and start your server, or open a live branch
  2. Open the Login page
  3. Login with a Google account.

Reviews

  • Code
  • Design
  • Product

@matticbot
Copy link
Contributor

@matticbot matticbot added the [Size] L Large sized issue label May 16, 2017
@pento
Copy link
Contributor Author

pento commented May 16, 2017

7e72fa3 mostly just adds a barely styled button, and enough code framework for things to run, but doesn't do much yet. 🙂

}

this.props.loginSocialUser( 'google', response.Zi.id_token ).then( () => {
this.props.onSuccess( this.state );
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

@yurynix
Copy link
Contributor

yurynix commented May 18, 2017

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?

@Tug
Copy link
Contributor

Tug commented May 18, 2017

LGTM 👍
I think we can come back to it later to improve the css for instance.

constructor() {
super();

this.handleGoogleResponse = this.handleGoogleResponse.bind( this );
Copy link
Member

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';
Copy link
Member

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.


export default connect(
( state ) => ( {
isRequesting: isRequesting( state ),
Copy link
Member

@gziolo gziolo May 18, 2017

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.

@gziolo
Copy link
Member

gziolo commented May 18, 2017

@pento do you plan to continue to work on this one or merge it as it is?
This PR has already 150 lines and is still behind the feature flag so we can merge it as it is and address remaining issues in the follow up PR.

@Tug
Copy link
Contributor

Tug commented May 18, 2017

@gziolo I addressed your comments, should be good to go now.
I agree we should try to merge it first as it will help us test the new social login endpoint.

@Tug Tug added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels May 18, 2017
@Tug Tug self-assigned this May 18, 2017
@@ -134,7 +134,7 @@ class Login extends Component {
}

return (
<LoginForm onSuccess={ this.handleValidUsernamePassword } />
Copy link
Contributor

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.

@drewblaisdell
Copy link
Contributor

I added a commit to fix 2FA and rebased. If you're cool with that (very minor) change, this LGTM. 👍

@drewblaisdell drewblaisdell added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 18, 2017
@@ -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',
Copy link
Contributor

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).

Copy link
Contributor

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

@Tug Tug merged commit 8c0ca8b into master May 19, 2017
@Tug Tug deleted the add/14076-social-login branch May 19, 2017 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants