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:
Matteo Pagliazzi
2018-05-25 18:16:30 +02:00
committed by GitHub
parent e81e458e9b
commit 8fb67e7944
5 changed files with 119 additions and 32 deletions

View File

@@ -19,7 +19,6 @@ function getUser () {
emails: [{
value: 'email@facebook',
}],
displayName: 'fb display name',
},
},
profile: {
@@ -100,7 +99,7 @@ describe('emails', () => {
let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']);
expect(data).to.have.property('name', user.auth.facebook.displayName);
expect(data).to.have.property('name', user.profile.name);
expect(data).to.have.property('email', user.auth.facebook.emails[0].value);
expect(data).to.have.property('_id', user._id);
expect(data).to.have.property('canSend', true);
@@ -110,13 +109,12 @@ describe('emails', () => {
let attachEmail = requireAgain(pathToEmailLib);
let getUserInfo = attachEmail.getUserInfo;
let user = getUser();
delete user.profile.name;
delete user.auth.local.email;
delete user.auth.facebook;
let data = getUserInfo(user, ['name', 'email', '_id', 'canSend']);
expect(data).to.have.property('name', user.auth.local.username);
expect(data).to.have.property('name', user.profile.name);
expect(data).not.to.have.property('email');
expect(data).to.have.property('_id', user._id);
expect(data).to.have.property('canSend', true);