diff --git a/options.html b/options.html index 6903268..87648cf 100644 --- a/options.html +++ b/options.html @@ -7,6 +7,7 @@

RLG-Web Options

+
Loading...
E-mail Password diff --git a/options.js b/options.js index 971ac30..11ff83f 100644 --- a/options.js +++ b/options.js @@ -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 --git a/style-rlg.css b/style-rlg.css index 890e91c..961c901 100644 --- a/style-rlg.css +++ b/style-rlg.css @@ -107,7 +107,12 @@ div#debug { /* For options.html */ div#switch { + display: none; margin-bottom: 1em; padding: 0.4em 0.4em; text-align: center; } + +div#ostat { + text-align: center; +}