Authored by htoooth

remove cookie

@@ -9,6 +9,7 @@ const sender = global.yoho.apmSender; @@ -9,6 +9,7 @@ const sender = global.yoho.apmSender;
9 const hostname = require('os').hostname(); 9 const hostname = require('os').hostname();
10 const routeEncode = require('./route-encode'); 10 const routeEncode = require('./route-encode');
11 const _ = require('lodash'); 11 const _ = require('lodash');
  12 +const config = global.yoho.config;
12 13
13 const forceNoCache = (res) => { 14 const forceNoCache = (res) => {
14 if (res) { 15 if (res) {
@@ -80,6 +81,18 @@ exports.serverError = () => { @@ -80,6 +81,18 @@ exports.serverError = () => {
80 logger.error(err); 81 logger.error(err);
81 82
82 if (err && err.code === 401) { 83 if (err && err.code === 401) {
  84 +
  85 + res.clearCookie('_UID', {
  86 + domain: config.cookieDomain
  87 + });
  88 + res.clearCookie('_TOKEN', {
  89 + domain: config.cookieDomain
  90 + });
  91 +
  92 + res.clearCookie('_SESSION_KEY', {
  93 + domain: config.cookieDomain
  94 + });
  95 +
83 if (req.xhr) { 96 if (req.xhr) {
84 err.data = {refer: helpers.urlFormat('/signin.html', {refer: req.get('Referer') || ''})}; 97 err.data = {refer: helpers.urlFormat('/signin.html', {refer: req.get('Referer') || ''})};
85 return res.json(err); 98 return res.json(err);