fix(clients): update email validation

This commit is contained in:
vladikoff 2015-02-20 08:42:17 +11:00
Родитель 05698e8475
Коммит 92d4bfc30d
2 изменённых файлов: 4 добавлений и 8 удалений

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

@ -35,11 +35,11 @@ exports.strategy = function() {
if (details.scope.indexOf(exports.SCOPE_CLIENT_MANAGEMENT) !== -1) {
logger.debug('check.whitelist');
var blocked = !WHITELIST.some(function(re) {
return re.test(details._email);
return re.test(details.email);
});
if (blocked) {
logger.warn('whitelist.blocked', {
email: details._email,
email: details.email,
token: tok
});
return reply(AppError.forbidden());

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

@ -23,15 +23,11 @@ exports.verify = function verify(token) {
// token.scope is a Set/Array
if (token.scope.indexOf('profile') !== -1 ||
token.scope.indexOf('profile:email') !== -1) {
token.scope.indexOf('profile:email') !== -1 ||
token.scope.indexOf(auth.SCOPE_CLIENT_MANAGEMENT) !== -1) {
tokenInfo.email = token.email;
}
// the schema validator for /v1/verify will prevent _email from leaking
if (token.scope.indexOf(auth.SCOPE_CLIENT_MANAGEMENT) !== -1) {
tokenInfo._email = token.email;
}
return tokenInfo;
});
};