div#console {
z-index: 9999;
position: absolute;
- top: 4px;
+ top: 10px;
}
div#console .terminal {
overflow-y: scroll;
<body>
<!-- Debug Console -->
<div id="console" class="row">
- <div class="col">
- <div class="switch">
- <label>
- <input type="checkbox" checked="true">
- <span class="lever"></span>
- Auto
- </label>
+ <div class="col s3">
+ <div class="row">
+ <div class="switch">
+ <label>
+ <input type="checkbox" checked="true">
+ <span class="lever"></span>
+ Auto
+ </label>
+ </div>
</div>
+
+ <div class="row">
+ <div class="input-field col ">
+ <input id="inputEvent" >
+ <label for="inputEvent">Event</label>
+ </div>
+ <a id="buttonTrigger" class="waves-effect waves-light btn">Trigger</a>
+ </div>
+
</div>
- <div class="col">
- <div class="terminal"></div>
+ <div class="col s9">
+ <div contentEditable="true" class="terminal"></div>
</div>
</div>
<!-- End Debug Console -->
/* attempt authentication, 'grant' event will be emitted on sucecss
and 'deny' will be emitted on failure */
- if (e.keyCode == 13)
- greeter.auth(username, pass);
+ if (e.keyCode == 13) {
+ greeter.auth(username, pass);
+ log.debug(pass.length);
+ log.debug("logging in with: " + username + " " + pass);
+ }
+
});
// when the user is authenticated do transitions and login
$(greeter).on("grant", () => {
+ log.debug("grant event");
let session_key = $session.children("option:selected").val();
greeter.login(session_key);
})
};
var $log;
var $autoscroll;
+var $buttonTrigger;
$(document).ready(()=> {
$log = $("#console .terminal");
$autoscroll = $("#console input");
+ $buttonTrigger = $("#buttonTrigger");
+
+ $log.keypress(function(e) {
+ e.preventDefault();
+ });
+ $buttonTrigger.click(() => {
+ let e = $("#inputEvent").val();
+ log.debug("triggering: " + e);
+ $(greeter).trigger(e);
+
+ });
});
var log = {
_parse(str, color) {
if (typeof str == "object") str = JSON.stringify(str,null, 2);
- str = "[" + moment().format("hh:mm:ss") + "]: " + str;
+
+ str = "[" + moment().format("hh:mm:ss") + "] " + str;
str = "<text style='color: " + color + "'>" + str + "</text>";
return $log.html() + str;
},
}
- auth(username, password, callback) {
- // lightdm must have each of
- let req = ["select_user", "is_authenticated", "authenticate"];
- if (!req.every((x) => this.lightdm.hasOwnProperty(x) )) {
+ auth(username="", password="", callback) {
+
+ if (!this.lightdm) {
log.warn("Cannot attempt login because lightdm is missing the " +
"required fields. Please note that lightdm is not explicitly " +
"instantiated in a browser session.");
return;
}
- username = username || this.lightdm.select_user;
- password = password || "";
- // session_key = session_key || lightdm.sessions[0].key;
-
let auth_cb = () => {
this.lightdm.respond(password);
}
this.$el = $("#splash-screen");
this.$content = $("#splash-screen-content");
this.options = this.getUserOptions();
- this.is_open = false;
+ this.state = "closed";
this.last_active = 0;
this.active_timeout = 15;
keyHandler(e) {
switch (e.keyCode) {
case 32:
- case 13:
- this.open();
+ case 13: // Enter key
+ if (this.state == "closed") this.open();
break;
- case 27:
+ case 27: // ESC key
if (this.state == "open") this.close();
else if (this.state == "closed") this.open();
break;
default:
- if (e.keyCode != 82 && e.keyCode != 17) // for testing
- this.open();
+ if (e.keyCode != 82 && e.keyCode != 17 && this.state == "closed") // for testing
+ this.open();
break;
}