GitHub signup fixes
* Don't fail when profile has no name set * Use scope that can only read public profile information (no scope) * Better error handling
This commit is contained in:
parent
53dee63a76
commit
32dc6a7358
@ -193,7 +193,6 @@ module.exports = async function(robot, kredits) {
|
|||||||
github: {
|
github: {
|
||||||
key: process.env.GITHUB_KEY,
|
key: process.env.GITHUB_KEY,
|
||||||
secret: process.env.GITHUB_SECRET,
|
secret: process.env.GITHUB_SECRET,
|
||||||
scope: ['user', 'public_repo'],
|
|
||||||
callback: '/kredits/signup/github'
|
callback: '/kredits/signup/github'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -235,7 +234,7 @@ module.exports = async function(robot, kredits) {
|
|||||||
if (!contributor) {
|
if (!contributor) {
|
||||||
let contributorAttr = {};
|
let contributorAttr = {};
|
||||||
contributorAttr.account = req.body.account;
|
contributorAttr.account = req.body.account;
|
||||||
contributorAttr.name = user.name;
|
contributorAttr.name = user.name || user.login;
|
||||||
contributorAttr.kind = "person";
|
contributorAttr.kind = "person";
|
||||||
contributorAttr.url = user.blog;
|
contributorAttr.url = user.blog;
|
||||||
contributorAttr.github_username = user.login;
|
contributorAttr.github_username = user.login;
|
||||||
@ -249,9 +248,10 @@ module.exports = async function(robot, kredits) {
|
|||||||
transactionHash: transaction.hash,
|
transactionHash: transaction.hash,
|
||||||
github_username: user.login
|
github_username: user.login
|
||||||
});
|
});
|
||||||
}).catch((error) => {
|
}, error => {
|
||||||
robot.logger.error(`[hubot-kredits] Error adding contributor:`, error);
|
robot.logger.error(`[hubot-kredits] Adding contributor failed: ${error}`);
|
||||||
res.sendStatus(500);
|
res.status(422);
|
||||||
|
res.json({ error })
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.json({
|
res.json({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user