From d41fbd6833f588439fdc6f1fd61bd1f806242580 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 3 Jan 2011 16:28:36 -0500 Subject: [PATCH] GetLoggedInFirst() now goes directly to destination_url if already logged in --- webcit/auth.c | 1 + webcit/static/authmethods.js | 19 ++++++++++++++++++- webcit/static/t/head.html | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/webcit/auth.c b/webcit/auth.c index 9373d19a4..653f0a3d6 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -950,6 +950,7 @@ int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP) { wcsession *WCC = WC; return (WCC != NULL)? (WCC->logged_in == 0) : 0; + } diff --git a/webcit/static/authmethods.js b/webcit/static/authmethods.js index 266535176..57550687a 100644 --- a/webcit/static/authmethods.js +++ b/webcit/static/authmethods.js @@ -6,13 +6,30 @@ */ +/* + * Are we logged in right now? + */ +function IsLoggedIn() { + if ($('is_logged_in').innerHTML == "yes") { + return 1; + } + else { + return 0; + } +} + + + /* * Wrapper script to require logging in before completing an action */ function GetLoggedInFirst(destination_url) { /* If logged in already, go directly to the destination. */ - /* FIXME implement this */ + if (IsLoggedIn()) { + window.location = destination_url; + return; + } /* If not logged in, go modal and ask the user to log in first. */ p = 'do_template?template=get_logged_in?destination_url=' + destination_url; diff --git a/webcit/static/t/head.html b/webcit/static/t/head.html index 60d1053c1..ae9e3f74f 100644 --- a/webcit/static/t/head.html +++ b/webcit/static/t/head.html @@ -26,7 +26,8 @@ - + +