mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
only store necessary data for social login (continuation of 10352) (#10395)
* feat(gdpr) only store necessary data for social login * feat(gdpr) also store email for social users * fix(social auth): store emails array instead of single email * fix(emails): do not get name from old facebook info * add migration to remove extra data from social profiles * update migration description * fix tests * fix typo in migration file
This commit is contained in:
@@ -171,29 +171,11 @@ function _setUpNewUser (user) {
|
||||
return _populateDefaultTasks(user, taskTypes);
|
||||
}
|
||||
|
||||
function _getFacebookName (fb) {
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
let possibleName = fb.displayName || fb.name || fb.username;
|
||||
|
||||
if (possibleName) {
|
||||
return possibleName;
|
||||
}
|
||||
|
||||
if (fb.first_name && fb.last_name) {
|
||||
return `${fb.first_name} ${fb.last_name}`;
|
||||
}
|
||||
}
|
||||
|
||||
function _setProfileName (user) {
|
||||
let google = user.auth.google;
|
||||
|
||||
let localUsername = user.auth.local && user.auth.local.username;
|
||||
let googleUsername = google && google.displayName;
|
||||
let anonymous = 'profile name not found';
|
||||
|
||||
return localUsername || _getFacebookName(user.auth.facebook) || googleUsername || anonymous;
|
||||
return localUsername || anonymous;
|
||||
}
|
||||
|
||||
schema.pre('validate', function preValidateUser (next) {
|
||||
|
||||
Reference in New Issue
Block a user