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
Conversation
Thank you for the great PR. |
lib/routes/login.js
Outdated
delete req.session.socialId; | ||
delete req.session.socialEmail; | ||
delete req.session.socialName; | ||
delete req.session.socialImage; |
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.
var loginSuccess = function(req, res, userData) { | ||
req.user = req.session.user = userData; | ||
if (!userData.password) { | ||
return res.redirect('/me/password'); | ||
} | ||
|
||
clearGoogleSession(req); | ||
clearSession(req); |
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.
lib/routes/login.js
Outdated
return res.redirect('/login?register=1'); | ||
} | ||
if (githubOrganizations && !User.isGitHubAccountValid(githubOrganizations)) { | ||
req.flash('registerWarningMessage', 'このアカウントはコネクトできません。'); |
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.
Can you make above of two messages English?
@lightnet328 Can you merge current master to resolve conflicts? |
lib/routes/me.js
Outdated
|
||
var userData = req.user; | ||
|
||
var toDisconnect = req.body.disconnectGitHub ? true : false; |
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.
const toDisconnect = !!req.body.disconnectGitHub;
lib/views/me/index.html
Outdated
|
||
<div class="col-sm-12"> | ||
<div class="text-center"> | ||
<input type="submit" name="connectGitHub" class="btn btn-github" value="GitHubコネクト"> |
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 found this button shows Japanese, should be translated.
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.
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?
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.
Well, it seems that it was not in a state to work after refactoring...
I fixed and translated it now.
lib/routes/login.js
Outdated
return loginFailure(req, res); | ||
} | ||
|
||
const { githubId: user_id } = tokenInfo; |
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.
Here met an error:
(node:84115) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: githubId is not defined
Is const { user_id: githubId }
instead?
Approved! it worked.
I'll merge it after you fix the conflict.
Overview
I implemented a feature to log in to Crowi using GitHub account.
Features
Changed
before: /register
after: /register/google
Screens