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

GitHub Authentication #282

Merged
merged 14 commits into from Jun 14, 2018
Merged

GitHub Authentication #282

merged 14 commits into from Jun 14, 2018

Conversation

@lightnet328
Copy link
Member

lightnet328 commented Mar 22, 2018

Overview

I implemented a feature to log in to Crowi using GitHub account.

Features

  • Log in to Crowi using GitHub account
  • Login restrictions by GitHub Organization

Changed

  • Callback url when registering with a Google Account
    • before: /register
    • after: /register/google
    • It just behaves like a login callback

Screens

0001
0002
0003
0004

@sotarok

This comment has been minimized.

Copy link
Member

sotarok commented Mar 27, 2018

Thank you for the great PR.
I'll check it.

@sotarok sotarok self-requested a review May 31, 2018
Copy link
Member

sotarok left a comment

Codes are almost okay!
I'll do QA then.

delete req.session.socialId;
delete req.session.socialEmail;
delete req.session.socialName;
delete req.session.socialImage;

This comment has been minimized.

Copy link
@sotarok
var loginSuccess = function(req, res, userData) {
req.user = req.session.user = userData;
if (!userData.password) {
return res.redirect('/me/password');
}

clearGoogleSession(req);
clearSession(req);

This comment has been minimized.

Copy link
@sotarok
return res.redirect('/login?register=1');
}
if (githubOrganizations && !User.isGitHubAccountValid(githubOrganizations)) {
req.flash('registerWarningMessage', 'このアカウントはコネクトできません。');

This comment has been minimized.

Copy link
@sotarok

sotarok May 31, 2018

Member

Can you make above of two messages English?

@sotarok

This comment has been minimized.

Copy link
Member

sotarok commented May 31, 2018

@lightnet328 Can you merge current master to resolve conflicts?


var userData = req.user;

var toDisconnect = req.body.disconnectGitHub ? true : false;

This comment has been minimized.

Copy link
@hiroppy

hiroppy Jun 1, 2018

Member
const toDisconnect = !!req.body.disconnectGitHub;
@lightnet328 lightnet328 force-pushed the lightnet328:github-auth branch from 463d969 to 9127e63 Jun 4, 2018
@lightnet328 lightnet328 force-pushed the lightnet328:github-auth branch from 9127e63 to a6aa1d1 Jun 4, 2018
@lightnet328 lightnet328 force-pushed the lightnet328:github-auth branch from 32e817b to da3df55 Jun 4, 2018
Copy link
Member

sotarok left a comment

@lightnet328 I met some errors while QA.
Can you make sure?


<div class="col-sm-12">
<div class="text-center">
<input type="submit" name="connectGitHub" class="btn btn-github" value="GitHubコネクト">

This comment has been minimized.

Copy link
@sotarok

sotarok Jun 9, 2018

Member

I found this button shows Japanese, should be translated.

This comment has been minimized.

Copy link
@sotarok

sotarok Jun 9, 2018

Member

And, after click this button, I met an error below:

TypeError: Cannot set property 'callbackAction' of undefined
   at actions.authGitHub (/Users/sotarok/working/crowi/crowi/lib/routes/me.js:291:41)

Is this feature (link account after account created) working?

This comment has been minimized.

Copy link
@lightnet328

lightnet328 Jun 11, 2018

Author Member

Well, it seems that it was not in a state to work after refactoring...
I fixed and translated it now.

return loginFailure(req, res);
}

const { githubId: user_id } = tokenInfo;

This comment has been minimized.

Copy link
@sotarok

sotarok Jun 9, 2018

Member

Here met an error:

(node:84115) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: githubId is not defined

Is const { user_id: githubId } instead?

Copy link
Member

sotarok left a comment

Approved! it worked.
I'll merge it after you fix the conflict.

@sotarok sotarok merged commit dd57d97 into crowi:master Jun 14, 2018
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
@sotarok sotarok mentioned this pull request Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.