Make the options page functional.
The options page now uses the /uinfo interface to change e-mail and password values.
This commit is contained in:
parent
0f71a90f8b
commit
eb2e44e13e
2 changed files with 39 additions and 4 deletions
37
options.js
37
options.js
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue