disable capabilities.account when no FXA_CLIENT_ID is set
This commit is contained in:
parent
e3087f008c
commit
93e82cf953
|
@ -1,3 +1,4 @@
|
|||
/* global AUTH_CONFIG */
|
||||
import { browserName } from './utils';
|
||||
|
||||
async function checkCrypto() {
|
||||
|
@ -64,9 +65,9 @@ export default async function capabilities() {
|
|||
const crypto = await checkCrypto();
|
||||
const nativeStreams = checkStreams();
|
||||
const polyStreams = nativeStreams ? false : polyfillStreams();
|
||||
let account = false;
|
||||
let account = typeof AUTH_CONFIG !== 'undefined';
|
||||
try {
|
||||
account = !!localStorage;
|
||||
account = account && !!localStorage;
|
||||
} catch (e) {
|
||||
// nevermind
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ const conf = convict({
|
|||
},
|
||||
fxa_client_id: {
|
||||
format: String,
|
||||
default: 'b50ec33d3c9beb6d', // localhost
|
||||
default: '', // disabled
|
||||
env: 'FXA_CLIENT_ID'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -29,8 +29,12 @@ if (config.analytics_id) {
|
|||
}
|
||||
|
||||
module.exports = async function(req, res) {
|
||||
let authConfig = '';
|
||||
if (config.fxa_client_id) {
|
||||
const fxaConfig = await getFxaConfig();
|
||||
fxaConfig.client_id = config.fxa_client_id;
|
||||
authConfig = `var AUTH_CONFIG = ${JSON.stringify(fxaConfig)};`;
|
||||
}
|
||||
/* eslint-disable no-useless-escape */
|
||||
const jsconfig = `
|
||||
var isIE = /trident\\\/7\.|msie/i.test(navigator.userAgent);
|
||||
|
@ -53,7 +57,7 @@ module.exports = async function(req, res) {
|
|||
var DEFAULTS = {
|
||||
EXPIRE_SECONDS: ${config.default_expire_seconds}
|
||||
};
|
||||
var AUTH_CONFIG = ${JSON.stringify(fxaConfig)};
|
||||
${authConfig};
|
||||
${ga}
|
||||
${sentry}
|
||||
`;
|
||||
|
|
Loading…
Reference in New Issue