# HG changeset patch # User John "Elwin" Edwards # Date 1346200705 25200 # Node ID 46822bd329dafb64bd373c47ec5754592b245dc6 # Parent bea4e7e703a2126366e83220a3a388d9bf8e3e4f Make the options page functional. The options page now uses the /uinfo interface to change e-mail and password values. diff -r bea4e7e703a2 -r 46822bd329da options.html --- a/options.html Mon Aug 27 21:28:10 2012 -0700 +++ b/options.html Tue Aug 28 17:38:25 2012 -0700 @@ -5,7 +5,7 @@ - +

RLG-Web Options

E-mail @@ -13,11 +13,11 @@
E-mail:
-
Save
Cancel
+
Save
Cancel
Password:
-
Save
Cancel
+
Save
Cancel
diff -r bea4e7e703a2 -r 46822bd329da options.js --- a/options.js Mon Aug 27 21:28:10 2012 -0700 +++ b/options.js Tue Aug 28 17:38:25 2012 -0700 @@ -1,1 +1,36 @@ -/* Nothing here yet. */ +function setup() { + if (!("lcred" in sessionStorage)) + 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"]; + } + req.open('GET', url, true); + req.send(); +} + +function postemail() { + if (!("lcred" in sessionStorage)) + return; + var posturl = "/uinfo/email?key=" + sessionStorage.getItem("lcred"); + var msg = {"v": document.getElementById("input_email").value}; + var req = new XMLHttpRequest(); + req.open('POST', posturl, true); + req.send(JSON.stringify(msg)); +} + +function postpw() { + if (!("lcred" in sessionStorage)) + return; + var posturl = "/uinfo/pw?key=" + sessionStorage.getItem("lcred"); + var msg = {"v": document.getElementById("input_pw").value}; + var req = new XMLHttpRequest(); + req.open('POST', posturl, true); + req.send(JSON.stringify(msg)); +}