obfuscate saved password when re-logging in
This commit is contained in:
parent
39e84f2744
commit
b30beac2b5
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var SENTINEL_PASSWORD = "************";
|
||||||
|
|
||||||
var $ = (document.querySelectorAll ?
|
var $ = (document.querySelectorAll ?
|
||||||
function(s) {
|
function(s) {
|
||||||
var r = document.querySelectorAll(s);
|
var r = document.querySelectorAll(s);
|
||||||
@ -261,8 +263,6 @@ var userlist = {
|
|||||||
return $(".userlist")[0].children.length;
|
return $(".userlist")[0].children.length;
|
||||||
},
|
},
|
||||||
'setInfo': function(nick, props) {
|
'setInfo': function(nick, props) {
|
||||||
console.log([nick, props]);
|
|
||||||
|
|
||||||
var baseClass = "user-" + b64(nick);
|
var baseClass = "user-" + b64(nick);
|
||||||
var $el = $("." + baseClass);
|
var $el = $("." + baseClass);
|
||||||
var prop_str = [];
|
var prop_str = [];
|
||||||
@ -296,12 +296,23 @@ var submit = function() {
|
|||||||
if (hub_state === 0) {
|
if (hub_state === 0) {
|
||||||
hub_state = 1;
|
hub_state = 1;
|
||||||
|
|
||||||
persistence_set("login", str);
|
hub_last_nick = str.split(":", 2)[0];
|
||||||
|
|
||||||
var name_parts = str.split(":", 2);
|
var hub_pass = "";
|
||||||
hub_last_nick = name_parts[0];
|
if (str.length > hub_last_nick.length) {
|
||||||
|
hub_pass = str.substr(hub_last_nick.length + 1);
|
||||||
|
}
|
||||||
|
if (hub_pass === SENTINEL_PASSWORD) {
|
||||||
|
// Probably not a real password. Attempt to load a better one from the saved state
|
||||||
|
var cache = persistence_get("login");
|
||||||
|
if (cache.indexOf(":") != -1) {
|
||||||
|
hub_pass = cache.substr(cache.indexOf(":") + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sock.emit('hello', {'nick' : hub_last_nick, 'pass' : name_parts.length >= 2 ? name_parts[1] : ''});
|
persistence_set("login", hub_last_nick+":"+hub_pass);
|
||||||
|
|
||||||
|
sock.emit('hello', {'nick' : hub_last_nick, 'pass' : hub_pass});
|
||||||
$("#chatbox").disabled = true;
|
$("#chatbox").disabled = true;
|
||||||
write("tab-main").system("Connecting...");
|
write("tab-main").system("Connecting...");
|
||||||
|
|
||||||
@ -675,7 +686,11 @@ var persistence_get = function(key, fallback) {
|
|||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
write("tab-main").system("Communicating with server...");
|
write("tab-main").system("Communicating with server...");
|
||||||
|
|
||||||
$("#chatbox").value = persistence_get("login", "");
|
var pre_login = persistence_get("login", "");
|
||||||
|
if (pre_login.indexOf(":") !== -1) {
|
||||||
|
pre_login = pre_login.substr(0, pre_login.indexOf(":")) + ":" + SENTINEL_PASSWORD;
|
||||||
|
}
|
||||||
|
$("#chatbox").value = pre_login;
|
||||||
show_joins = persistence_get("show_joins", false);
|
show_joins = persistence_get("show_joins", false);
|
||||||
|
|
||||||
document.title = DCWEBUI_CONF.title;
|
document.title = DCWEBUI_CONF.title;
|
||||||
|
Loading…
Reference in New Issue
Block a user