Store user and password in session storage
Allow reloading of the page.
This commit is contained in:
parent
4afbefbc9f
commit
37c9a1da18
@ -449,6 +449,7 @@ function LoginScene() {
|
|||||||
var logout_view = document.getElementById("logoutview");
|
var logout_view = document.getElementById("logoutview");
|
||||||
var logout_user_form = logout_view.querySelector("[name=user]");
|
var logout_user_form = logout_view.querySelector("[name=user]");
|
||||||
var logout_btn = logout_view.querySelector("[name=link]");
|
var logout_btn = logout_view.querySelector("[name=link]");
|
||||||
|
var first_show = true;
|
||||||
|
|
||||||
/** @type {?number} */ var scene_index = null;
|
/** @type {?number} */ var scene_index = null;
|
||||||
var user = "";
|
var user = "";
|
||||||
@ -490,6 +491,10 @@ function LoginScene() {
|
|||||||
// show collections
|
// show collections
|
||||||
var saved_user = user;
|
var saved_user = user;
|
||||||
user = "";
|
user = "";
|
||||||
|
if (typeof(sessionStorage) !== "undefined") {
|
||||||
|
sessionStorage.setItem("radicale_user", saved_user);
|
||||||
|
sessionStorage.setItem("radicale_password", password);
|
||||||
|
}
|
||||||
var collections_scene = new CollectionsScene(
|
var collections_scene = new CollectionsScene(
|
||||||
saved_user, password, collection, function(error1) {
|
saved_user, password, collection, function(error1) {
|
||||||
error = error1;
|
error = error1;
|
||||||
@ -522,12 +527,24 @@ function LoginScene() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.show = function() {
|
this.show = function() {
|
||||||
|
var saved_first_show = first_show;
|
||||||
|
first_show = false;
|
||||||
this.release();
|
this.release();
|
||||||
fill_form();
|
fill_form();
|
||||||
form.onsubmit = onlogin;
|
form.onsubmit = onlogin;
|
||||||
html_scene.style.display = "block";
|
html_scene.style.display = "block";
|
||||||
user_form.focus();
|
user_form.focus();
|
||||||
scene_index = scene_stack.length - 1;
|
scene_index = scene_stack.length - 1;
|
||||||
|
if (typeof(sessionStorage) !== "undefined") {
|
||||||
|
if (saved_first_show && sessionStorage.getItem("radicale_user")) {
|
||||||
|
user_form.value = sessionStorage.getItem("radicale_user");
|
||||||
|
password_form.value = sessionStorage.getItem("radicale_password");
|
||||||
|
onlogin();
|
||||||
|
} else {
|
||||||
|
sessionStorage.setItem("radicale_user", "");
|
||||||
|
sessionStorage.setItem("radicale_password", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
this.hide = function() {
|
this.hide = function() {
|
||||||
read_form();
|
read_form();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user