auto-assign profile pic

This commit is contained in:
Evert Prants 2017-09-07 00:06:17 +03:00
parent a632baf6cb
commit d4af131481
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -137,6 +137,7 @@
oAuthid: profile.id, oAuthid: profile.id,
handle: profile.displayName, handle: profile.displayName,
email: profile.emails[0].value, email: profile.emails[0].value,
picture: profile.picture,
isAdmin: profile.isAdmin isAdmin: profile.isAdmin
}, function(err, user) { }, function(err, user) {
if (err) { if (err) {
@ -175,6 +176,7 @@
profile.displayName = data.display_name; profile.displayName = data.display_name;
profile.emails = [{ value: data.email }]; profile.emails = [{ value: data.email }];
profile.isAdmin = data.privilege === 5; profile.isAdmin = data.privilege === 5;
profile.picture = 'https://icynet.eu/api/avatar/' + data.id
// Do you want to automatically make somebody an admin? This line might help you do that... // Do you want to automatically make somebody an admin? This line might help you do that...
// profile.isAdmin = data.isAdmin ? true : false; // profile.isAdmin = data.isAdmin ? true : false;
@ -225,7 +227,8 @@
if (!uid) { if (!uid) {
User.create({ User.create({
username: payload.handle, username: payload.handle,
email: payload.email email: payload.email,
picture: payload.picture
}, function(err, uid) { }, function(err, uid) {
if(err) { if(err) {
return callback(err); return callback(err);