# HG changeset patch # User John "Elwin" Edwards # Date 1346252126 25200 # Node ID a2e071a950552b80e7df7c399db0fd144bd3cd47 # Parent 46822bd329dafb64bd373c47ec5754592b245dc6 Options page: handle not being logged in. The options page now displays whether or not the user is logged in. diff -r 46822bd329da -r a2e071a95055 options.html --- a/options.html Tue Aug 28 17:38:25 2012 -0700 +++ b/options.html Wed Aug 29 07:55:26 2012 -0700 @@ -7,6 +7,7 @@

RLG-Web Options

+
Loading...
E-mail Password diff -r 46822bd329da -r a2e071a95055 options.js --- a/options.js Tue Aug 28 17:38:25 2012 -0700 +++ b/options.js Wed Aug 29 07:55:26 2012 -0700 @@ -1,20 +1,33 @@ function setup() { - if (!("lcred" in sessionStorage)) + if (!("lcred" in sessionStorage)) { + setstatus("You are not logged in."); return; + } var url = "/uinfo/email?key=" + sessionStorage.getItem("lcred"); var req = new XMLHttpRequest(); req.onreadystatechange = function () { if (req.readyState != 4 || req.status != 200) return; var reply = JSON.parse(req.responseText); - if (!("email" in reply)) - return; - document.getElementById("input_email").value = reply["email"]; + if (!("email" in reply)) { + setstatus("You are not logged in."); + } + else { + setstatus("You are logged in as " + reply.u + "."); + document.getElementById("input_email").value = reply["email"]; + document.getElementById("switch").style.display = "block"; + } } req.open('GET', url, true); req.send(); } +function setstatus(stattext) { + var statnode = document.createTextNode(stattext); + var statdiv = document.getElementById("ostat"); + statdiv.replaceChild(statnode, statdiv.firstChild); +} + function postemail() { if (!("lcred" in sessionStorage)) return; diff -r 46822bd329da -r a2e071a95055 style-rlg.css --- a/style-rlg.css Tue Aug 28 17:38:25 2012 -0700 +++ b/style-rlg.css Wed Aug 29 07:55:26 2012 -0700 @@ -107,7 +107,12 @@ /* For options.html */ div#switch { + display: none; margin-bottom: 1em; padding: 0.4em 0.4em; text-align: center; } + +div#ostat { + text-align: center; +}