Mercurial > hg > rlgwebd
comparison options.js @ 129:46822bd329da
Make the options page functional.
The options page now uses the /uinfo interface to change e-mail and
password values.
| author | John "Elwin" Edwards <elwin@sdf.org> |
|---|---|
| date | Tue, 28 Aug 2012 17:38:25 -0700 |
| parents | bea4e7e703a2 |
| children | a2e071a95055 |
comparison
equal
deleted
inserted
replaced
| 128:bea4e7e703a2 | 129:46822bd329da |
|---|---|
| 1 /* Nothing here yet. */ | 1 function setup() { |
| 2 if (!("lcred" in sessionStorage)) | |
| 3 return; | |
| 4 var url = "/uinfo/email?key=" + sessionStorage.getItem("lcred"); | |
| 5 var req = new XMLHttpRequest(); | |
| 6 req.onreadystatechange = function () { | |
| 7 if (req.readyState != 4 || req.status != 200) | |
| 8 return; | |
| 9 var reply = JSON.parse(req.responseText); | |
| 10 if (!("email" in reply)) | |
| 11 return; | |
| 12 document.getElementById("input_email").value = reply["email"]; | |
| 13 } | |
| 14 req.open('GET', url, true); | |
| 15 req.send(); | |
| 16 } | |
| 17 | |
| 18 function postemail() { | |
| 19 if (!("lcred" in sessionStorage)) | |
| 20 return; | |
| 21 var posturl = "/uinfo/email?key=" + sessionStorage.getItem("lcred"); | |
| 22 var msg = {"v": document.getElementById("input_email").value}; | |
| 23 var req = new XMLHttpRequest(); | |
| 24 req.open('POST', posturl, true); | |
| 25 req.send(JSON.stringify(msg)); | |
| 26 } | |
| 27 | |
| 28 function postpw() { | |
| 29 if (!("lcred" in sessionStorage)) | |
| 30 return; | |
| 31 var posturl = "/uinfo/pw?key=" + sessionStorage.getItem("lcred"); | |
| 32 var msg = {"v": document.getElementById("input_pw").value}; | |
| 33 var req = new XMLHttpRequest(); | |
| 34 req.open('POST', posturl, true); | |
| 35 req.send(JSON.stringify(msg)); | |
| 36 } |
