Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Fix ESLint console warnings #1337

Closed
wants to merge 5 commits into from
Closed

Fix ESLint console warnings #1337

wants to merge 5 commits into from

Conversation

fauria
Copy link
Contributor

@fauria fauria commented May 18, 2016

fix (config): ESLint console warnings

Adds 'no-console': 1 option to .eslintrc.

Fixes #1336

Update:

fix redirect to '[object Object]' after login with social accounts.

Fixes #1284

Update 2:

fix TypeError: Cannot read property 'additionalProvidersData' of undefined at SocialAccountsController.hasConnectedAdditionalSocialAccounts. Use vm instead of $scope.

Fixes #1347

@coveralls
Copy link

coveralls commented May 18, 2016

Coverage Status

Coverage remained the same at 70.615% when pulling 9a1dd22 on fauria:master into 5da5a61 on meanjs:master.

@fauria
Copy link
Contributor Author

fauria commented May 18, 2016

Those Travis failures seem to be unrelated to this PR, although they should be checked, specially #3 (Error: expected 200 "OK", got 400 "Bad Request")

@ilanbiala
Copy link
Member

Reran build, I think that was just a temporary thing.

@coveralls
Copy link

coveralls commented May 30, 2016

Coverage Status

Coverage decreased (-0.6%) to 69.989% when pulling edc663f on fauria:master into 5da5a61 on meanjs:master.

@fauria
Copy link
Contributor Author

fauria commented May 31, 2016

Should not affect code coverage...

@@ -116,7 +116,7 @@ exports.oauthCallback = function (strategy) {
return res.redirect('/authentication/signin');
}

return res.redirect(redirectURL || sessionRedirectURL || '/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this fix?

Copy link

@OneOfTheWorld OneOfTheWorld Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems can not simply update:
return res.redirect(redirectURL || sessionRedirectURL || '/');
to:
return res.redirect(sessionRedirectURL || '/');

because before oauthCallback function called, there will be another function saveOAuthUserProfile execute before it and have the following code snippet to pass value to redirectURL:
user.save(function (err) { return done(err, user, '/settings/accounts'); });
so, if pass value to redirectURL, the value will be right, if do not pass anything, the value will become an object.

for your reference, thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fauria can you please refer to this comment by @OneOfTheWorld ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get @OneOfTheWorld point, the thing is, oauthCallback is actually called before saveOAuthUserProfile so even if we do:

user.save(function (err) {
  req.session.redirect_to = '/settings/accounts';
  return done(err, user);
});

the redirection will still not be applied.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fauria I already merged your commit with @OneOfTheWorld change.
If it's still not solving the problem, do you want to issue a PR that does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A PR would be fine, I think it would be a good idea to review the authentication process and rework the redirections.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're always open for improvements. Go ahead and open a PR and let's see what's on the table.
We already had a big refactoring to the authentication and authorization code one time.

@coveralls
Copy link

coveralls commented Jun 3, 2016

Coverage Status

Coverage decreased (-0.6%) to 69.989% when pulling 66c6dc5 on fauria:master into 5da5a61 on meanjs:master.

@lirantal
Copy link
Member

@fauria so where does this PR stand?
To be honest it would've been better if you had made a separate PR for each fix, because this way we're coupling all the fixes to this one PR. Not ideal...

@fauria
Copy link
Contributor Author

fauria commented Jun 18, 2016

@lirantal Yeah, I know. I thought they were going to be merged faster, so I didn't think on multiple branches...

@lirantal
Copy link
Member

So right now I'm not sure on the state of this PR - is everything really taken care of? or do you want to create 3 new PRs for us to review and assess them each on it's own?

@fauria
Copy link
Contributor Author

fauria commented Jun 19, 2016

They are quite trivial, doesn't look like they need there own PR...

@lirantal
Copy link
Member

lirantal commented Jul 6, 2016

@fauria I ended up fixing the issue mentioned by @OneOfTheWorld in another PR: #1388

@fauria thanks for all your help! Hope to see you again with another PR :)

@lirantal lirantal closed this Jul 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants