Basic authentication flow

This commit is contained in:
Jakub Nowak 2025-02-09 20:43:04 +08:00
parent c58cf0e10c
commit 2e38ecd15b
4 changed files with 33 additions and 3 deletions

25
js/authenticate.js Normal file
View 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);
}