Blame view

apps/passport/models/refer-service.js 410 Bytes
htoooth authored
1
/**
htoooth authored
2
 * 跳转白名单,只有这个才能正确跳转
htoooth authored
3 4 5 6 7 8
 * Created by TaoHuang on 2016/11/29.
 */

'use strict';

const _ = require('lodash');
htoooth authored
9 10
const url = require('url');
const config = global.yoho.config;
htoooth authored
11
htoooth authored
12
const allowedList = [/yohobuy\.com$/i, /yoho\.cn$/i];
htoooth authored
13 14

module.exports = (refer) => {
htoooth authored
15
    return _.some(allowedList, allowed => allowed.test(url.parse(refer || config.siteUrl, false, true).hostname));
htoooth authored
16
};