Basic authentication flow
This commit is contained in:
parent
c58cf0e10c
commit
2e38ecd15b
4 changed files with 33 additions and 3 deletions
|
@ -58,7 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-container">
|
<div class="input-container">
|
||||||
<input placeholder="" type="password" tabindex="1" />
|
<input id="password-input" placeholder="" type="password" tabindex="1" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@
|
||||||
<script src="js/session-select.js"></script>
|
<script src="js/session-select.js"></script>
|
||||||
<script src="js/idle-hide.js"></script>
|
<script src="js/idle-hide.js"></script>
|
||||||
<script src="js/hostname.js"></script>
|
<script src="js/hostname.js"></script>
|
||||||
|
<script src="js/authenticate.js"></script>
|
||||||
<script src="js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
25
js/authenticate.js
Normal file
25
js/authenticate.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
function authenticate(){
|
||||||
|
const selectedUser = users[currentUser].id;
|
||||||
|
|
||||||
|
lightdm.cancel_authentication();
|
||||||
|
lightdm.authenticate(selectedUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function authenticationComplete() {
|
||||||
|
const selectedSession = sessions[currentSession].id;
|
||||||
|
|
||||||
|
await lightdm.respond($("#password-input").value);
|
||||||
|
lightdm.start_session(selectedSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindAuthenticate() {
|
||||||
|
$("#password-input").onkeypress = function(e) {
|
||||||
|
var keycode = e.code || e.key;
|
||||||
|
if(keycode == "Enter"){
|
||||||
|
authenticate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.lightdm.authentication_complete.connect(authenticationComplete);
|
||||||
|
}
|
|
@ -1 +1,5 @@
|
||||||
function $(c) { return document.querySelector(c); }
|
function $(c) { return document.querySelector(c); }
|
||||||
|
|
||||||
|
function wait(ms) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ async function initGreeter(){
|
||||||
populateSessions();
|
populateSessions();
|
||||||
populateUsers();
|
populateUsers();
|
||||||
|
|
||||||
console.log(lightdm.default_session);
|
bindAuthenticate();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("GreeterReady", () => {
|
window.addEventListener("GreeterReady", () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue