From 99842d47825328d50e5d4bd43a6956b2f0994f19 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 28 Mar 2016 11:25:15 -0700 Subject: [PATCH] we setup adminFqdn now in SPF --- cloudron.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudron.js b/cloudron.js index 052f7b3..75bc94a 100644 --- a/cloudron.js +++ b/cloudron.js @@ -19,6 +19,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; function Cloudron(box) { this._box = box; this._isCustomDomain = box.domain === process.env.CUSTOM_DOMAIN; + this._adminFqdn = this._isCustomDomain ? 'my.' + box.domain : 'my-' + box.domain; this._origin = this._isCustomDomain ? 'https://my.' + box.domain : 'https://my-' + box.domain; this._credentials = { @@ -310,7 +311,7 @@ Cloudron.prototype.checkSPF = function (callback) { if (error) return callback(error); if (records.length !== 1 || records[0].length !== 1) return callback(new Error('Got ' + JSON.stringify(records) + ' TXT records. Expecting 1 length 2d array')); - if (records[0][0].search(new RegExp('^v=spf1 a:' + that._box.domain + ' ~all$')) !== 0) return callback(new Error('Bad SPF record. ' + records[0][0])); + if (records[0][0].search(new RegExp('^v=spf1 a:' + that._adminFqdn + ' ~all$')) !== 0) return callback(new Error('Bad SPF record. ' + records[0][0])); callback(null, records); });