on login double check that github username
if different, assign user to new name
This commit is contained in:
@ -41,20 +41,23 @@ export default function(UserIdent) {
|
|||||||
userChanged = true;
|
userChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if user is not github cool
|
// if user signed in with github
|
||||||
// and user signed in with github
|
// and user is not github cool
|
||||||
|
// or username is different from github username
|
||||||
// then make them github cool
|
// then make them github cool
|
||||||
// and set their username from their github profile.
|
// and set their username from their github profile.
|
||||||
if (!user.isGithubCool && userIdent.provider === 'github-login') {
|
if (
|
||||||
debug(`
|
userIdent.provider === 'github-login' &&
|
||||||
user isn't github cool yet but signed in with github
|
(!user.isGithubCool ||
|
||||||
lets make them cool!
|
user.username !== userIdent.provider.username.toLowerCase())
|
||||||
`);
|
) {
|
||||||
|
debug("user isn't github cool or username from github is different");
|
||||||
user.isGithubCool = true;
|
user.isGithubCool = true;
|
||||||
user.username = userIdent.profile.username.toLowerCase();
|
user.username = userIdent.profile.username.toLowerCase();
|
||||||
userChanged = true;
|
userChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (userChanged) {
|
if (userChanged) {
|
||||||
return user.save(function(err) {
|
return user.save(function(err) {
|
||||||
if (err) { return next(err); }
|
if (err) { return next(err); }
|
||||||
|
Reference in New Issue
Block a user