refactor(email): Fixes #352 Remove ability to fetch email address (#543) r=@shane-tomlinson

This commit is contained in:
Deepti 2018-04-19 18:10:33 +05:30 коммит произвёл Shane Tomlinson
Родитель d3cda9d0de
Коммит 068bd4baea
2 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -12,7 +12,7 @@ module.exports = {
validate: {
payload: {
token: validators.token.required(),
email: Joi.boolean().default(false)
email: Joi.boolean().optional()
}
},
response: {
@ -25,15 +25,14 @@ module.exports = {
},
handler: function verify(req, reply) {
token.verify(req.payload.token).then(function(info) {
if (req.payload.email) {
if (req.payload.email !== undefined) {
logger.warn('email.requested', {
user: info.user,
client_id: info.client_id,
scope: info.scope
});
} else {
delete info.email;
}
delete info.email;
logger.info('verify.success', {
client_id: info.client_id,
scope: info.scope

Просмотреть файл

@ -2768,7 +2768,7 @@ describe('/v1', function() {
});
});
it('should not return the email if email:false for profile:email scope', function() {
it('should not return email for payload having email:false', function() {
return newToken({ scope: 'profile:email' }).then(function(res) {
assert.equal(res.statusCode, 200);
assertSecurityHeaders(res);
@ -2786,7 +2786,7 @@ describe('/v1', function() {
});
});
it('should return the email if opted in', function() {
it('should not return email for payload having email:true', function() {
return newToken({ scope: 'profile:email' }).then(function(res) {
assert.equal(res.statusCode, 200);
assertSecurityHeaders(res);
@ -2800,7 +2800,7 @@ describe('/v1', function() {
}).then(function(res) {
assert.equal(res.statusCode, 200);
assertSecurityHeaders(res);
assert.equal(res.result.email, VEMAIL);
assert.equal(res.result.email, undefined);
});
});