diff --git a/controller/site.js b/controller/site.js index e6d9aea..d8dbcc0 100644 --- a/controller/site.js +++ b/controller/site.js @@ -23,6 +23,12 @@ exports.login = function(req, res, next) { res.redirect(oauth2.getAuthorizationUrl({scope: 'api'})); } +exports.logout = function(req, res, next) { + delete res.locals.session; + delete res.req.session; + res.redirect('/'); +} + exports.callback = function(req, res, next) { console.log(req.session.oauth2); var conn = new jsforce.Connection({ diff --git a/routes/web_router.js b/routes/web_router.js index 3d52726..1eb171e 100644 --- a/routes/web_router.js +++ b/routes/web_router.js @@ -11,6 +11,7 @@ module.exports = function(app) { app.get('/', site.index); app.post('/login', site.login); + app.get('/logout', site.logout); app.get('/about', site.about); app.get('/oauth/callback', site.callback); app.get('/account/o', account.list); diff --git a/views/template/header.html b/views/template/header.html index 08573b9..9ec0764 100644 --- a/views/template/header.html +++ b/views/template/header.html @@ -61,13 +61,11 @@