forked from FoundKeyGang/FoundKey
Specify Cookie domain with hostname
This commit is contained in:
parent
a23790a1e8
commit
0109e0811c
4 changed files with 6 additions and 3 deletions
|
@ -4,7 +4,7 @@ export default function(res, user, redirect: boolean) {
|
||||||
const expires = 1000 * 60 * 60 * 24 * 365; // One Year
|
const expires = 1000 * 60 * 60 * 24 * 365; // One Year
|
||||||
res.cookie('i', user.token, {
|
res.cookie('i', user.token, {
|
||||||
path: '/',
|
path: '/',
|
||||||
domain: `.${config.host}`,
|
domain: `.${config.hostname}`,
|
||||||
secure: config.url.substr(0, 5) === 'https',
|
secure: config.url.substr(0, 5) === 'https',
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
expires: new Date(Date.now() + expires),
|
expires: new Date(Date.now() + expires),
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { EventEmitter } from 'eventemitter3';
|
||||||
import * as merge from 'object-assign-deep';
|
import * as merge from 'object-assign-deep';
|
||||||
import * as uuid from 'uuid';
|
import * as uuid from 'uuid';
|
||||||
|
|
||||||
import { host, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config';
|
import { hostname, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config';
|
||||||
import Progress from './scripts/loading';
|
import Progress from './scripts/loading';
|
||||||
import Connection from './scripts/streaming/stream';
|
import Connection from './scripts/streaming/stream';
|
||||||
import { HomeStreamManager } from './scripts/streaming/home';
|
import { HomeStreamManager } from './scripts/streaming/home';
|
||||||
|
@ -220,7 +220,7 @@ export default class MiOS extends EventEmitter {
|
||||||
|
|
||||||
public signout() {
|
public signout() {
|
||||||
localStorage.removeItem('me');
|
localStorage.removeItem('me');
|
||||||
document.cookie = `i=; domain=.${host}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
|
document.cookie = `i=; domain=.${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
|
||||||
location.href = '/';
|
location.href = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
declare const _HOST_: string;
|
declare const _HOST_: string;
|
||||||
|
declare const _HOSTNAME_: string;
|
||||||
declare const _URL_: string;
|
declare const _URL_: string;
|
||||||
declare const _API_URL_: string;
|
declare const _API_URL_: string;
|
||||||
declare const _DOCS_URL_: string;
|
declare const _DOCS_URL_: string;
|
||||||
|
@ -16,6 +17,7 @@ declare const _LICENSE_: string;
|
||||||
declare const _GOOGLE_MAPS_API_KEY_: string;
|
declare const _GOOGLE_MAPS_API_KEY_: string;
|
||||||
|
|
||||||
export const host = _HOST_;
|
export const host = _HOST_;
|
||||||
|
export const hostname = _HOSTNAME_;
|
||||||
export const url = _URL_;
|
export const url = _URL_;
|
||||||
export const apiUrl = _API_URL_;
|
export const apiUrl = _API_URL_;
|
||||||
export const docsUrl = _DOCS_URL_;
|
export const docsUrl = _DOCS_URL_;
|
||||||
|
|
|
@ -84,6 +84,7 @@ module.exports = entries.map(x => {
|
||||||
_CH_URL_: config.ch_url,
|
_CH_URL_: config.ch_url,
|
||||||
_LANG_: lang,
|
_LANG_: lang,
|
||||||
_HOST_: config.host,
|
_HOST_: config.host,
|
||||||
|
_HOSTNAME_: config.hostname,
|
||||||
_URL_: config.url,
|
_URL_: config.url,
|
||||||
_LICENSE_: licenseHtml,
|
_LICENSE_: licenseHtml,
|
||||||
_GOOGLE_MAPS_API_KEY_: config.google_maps_api_key
|
_GOOGLE_MAPS_API_KEY_: config.google_maps_api_key
|
||||||
|
|
Loading…
Reference in a new issue