From 388599ac28f60e833a3e87ed45f0969c843b6107 Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Sat, 7 Dec 2013 01:46:49 -0500 Subject: [PATCH] Tumblr now also redirects to unauthorized page if no token found --- controllers/api.js | 7 +++++++ views/api/tumblr.jade | 12 +----------- views/api/unauthorized.jade | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/controllers/api.js b/controllers/api.js index 5d50c349b3..ec26c42900 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -65,6 +65,13 @@ exports.getFoursquare = function(req, res) { * GET /api/tumblr */ exports.getTumblr = function(req, res) { + if (!req.user.tokens.tumblr) { + return res.render('api/unauthorized', { + title: 'Tumblr API', + provider: 'Tumblr', + user: req.user + }); + } res.render('api/tumblr', { title: 'Tumblr API', diff --git a/views/api/tumblr.jade b/views/api/tumblr.jade index 60bb92dd4c..8ca73ea381 100644 --- a/views/api/tumblr.jade +++ b/views/api/tumblr.jade @@ -6,14 +6,4 @@ block content i.fa.fa-tumblr-square | Tumblr API - if !user.tokens.tumblr - h3 - i.fa.fa-shield - | Authorization Required - a(href='/auth/tumblr') - .label.label-primary.label-block - h2 - i.fa.fa-qrcode - | Get Tumblr Token - else - h2 else + .btn.btn-success Authorized! diff --git a/views/api/unauthorized.jade b/views/api/unauthorized.jade index d4c0929ae2..17a0beef0d 100644 --- a/views/api/unauthorized.jade +++ b/views/api/unauthorized.jade @@ -4,6 +4,6 @@ block content h3 i.fa.fa-lock | Authorization Required - a.btn.btn-lg.btn-primary(href='/auth/foursquare') + a.btn.btn-lg.btn-primary(href='/auth/tumblr') i.fa.fa-qrcode | Get #{provider} Token \ No newline at end of file