0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 Fixed URL is not a constructor for Node v6 (#10289)

closes #10287
This commit is contained in:
Katharina Irrgang 2018-12-17 12:53:45 +01:00 committed by Rishabh Garg
parent aca887a35d
commit 799857b77a
3 changed files with 10 additions and 8 deletions

View file

@ -23,8 +23,9 @@ function verifySessionHash(salt, hash) {
function getRedirectUrl(query) {
const redirect = decodeURIComponent(query.r || '/');
try {
return new url.URL(redirect, urlService.utils.urlFor('home', true)).pathname;
return url.parse(redirect).pathname;
} catch (e) {
return '/';
}

View file

@ -1,11 +1,8 @@
const URL = require('url').URL;
const jwt = require('express-jwt');
const membersService = require('../../members');
const labs = require('../../labs');
const config = require('../../../config');
const siteOrigin = new URL(config.get('url')).origin;
let UNO_MEMBERINO;
module.exports = {
@ -15,7 +12,12 @@ module.exports = {
return next();
};
}
if (!UNO_MEMBERINO) {
const url = require('url');
const {protocol, host} = url.parse(config.get('url'));
const siteOrigin = `${protocol}//${host}`;
UNO_MEMBERINO = jwt({
credentialsRequired: false,
requestProperty: 'member',

View file

@ -1,8 +1,8 @@
const url = require('url');
const settingsCache = require('../settings/cache');
const config = require('../../config');
const MembersApi = require('../../lib/members');
const models = require('../../models');
const URL = require('url').URL;
const mail = require('../mail');
function createMember({name, email, password}) {
@ -60,9 +60,8 @@ const publicKey = settingsCache.get('members_public_key');
const privateKey = settingsCache.get('members_private_key');
const sessionSecret = settingsCache.get('members_session_secret');
const passwordResetUrl = config.get('url');
const siteOrigin = new URL(config.get('url')).origin;
const {protocol, host} = url.parse(config.get('url'));
const siteOrigin = `${protocol}//${host}`;
const issuer = siteOrigin;
const ssoOrigin = siteOrigin;
let mailer;