Fixed issue with faulty object iteration.

This commit is contained in:
Tim Brandin 2017-06-15 13:43:45 +02:00
parent d4f5fb941b
commit b046af39ba

View file

@ -97,7 +97,8 @@ Accounts.ui.config = function(options) {
// Deal with `requestPermissions` // Deal with `requestPermissions`
if (options.requestPermissions) { if (options.requestPermissions) {
options.requestPermissions.forEach(function (scope, service) { Object.keys(options.requestPermissions).forEach(service => {
const score = options.requestPermissions[service];
if (Accounts.ui._options.requestPermissions[service]) { if (Accounts.ui._options.requestPermissions[service]) {
throw new Error("Accounts.ui.config: Can't set `requestPermissions` more than once for " + service); throw new Error("Accounts.ui.config: Can't set `requestPermissions` more than once for " + service);
} }
@ -112,7 +113,8 @@ Accounts.ui.config = function(options) {
// Deal with `requestOfflineToken` // Deal with `requestOfflineToken`
if (options.requestOfflineToken) { if (options.requestOfflineToken) {
options.requestOfflineToken.forEach(function (value, service) { Object.keys(options.requestOfflineToken).forEach(service => {
const value = options.requestOfflineToken[service];
if (service !== 'google') if (service !== 'google')
throw new Error("Accounts.ui.config: `requestOfflineToken` only supported for Google login at the moment."); throw new Error("Accounts.ui.config: `requestOfflineToken` only supported for Google login at the moment.");
@ -127,7 +129,8 @@ Accounts.ui.config = function(options) {
// Deal with `forceApprovalPrompt` // Deal with `forceApprovalPrompt`
if (options.forceApprovalPrompt) { if (options.forceApprovalPrompt) {
options.forceApprovalPrompt.forEach(function (value, service) { Object.keys(options.forceApprovalPrompt).forEach(service => {
const value = options.forceApprovalPrompt[service];
if (service !== 'google') if (service !== 'google')
throw new Error("Accounts.ui.config: `forceApprovalPrompt` only supported for Google login at the moment."); throw new Error("Accounts.ui.config: `forceApprovalPrompt` only supported for Google login at the moment.");