Browse Source

Added guest account support to Gruvbox theme

sisyphus
JezerM 3 years ago
parent
commit
df67d344b2
No known key found for this signature in database
GPG Key ID: 66BBC5D01388C6B5
  1. 11
      themes/gruvbox/js/accounts.js
  2. 10
      themes/gruvbox/js/authenticate.js

11
themes/gruvbox/js/accounts.js vendored

@ -35,6 +35,17 @@ class Accounts {
this._setAccountDefault() this._setAccountDefault()
} }
_setGuestAccount() {
if (lightdm.has_guest_account) {
this._guestAccount = `guest-account-${Math.floor(Math.random() * 1000)}`
this._usersObject.push({
username: this._guestAccount,
display_name: "Guest",
image: ""
})
}
}
_setAccountList() { _setAccountList() {
var dropdown = this._accountsList.querySelector(".dropdown") var dropdown = this._accountsList.querySelector(".dropdown")
dropdown.innerHTML = "" dropdown.innerHTML = ""

10
themes/gruvbox/js/authenticate.js vendored

@ -28,19 +28,25 @@ class Authenticate {
_respond() { _respond() {
var input = document.querySelector("#input-password") var input = document.querySelector("#input-password")
let username = accounts.getDefaultUserName()
input.blur() input.blur()
input.disabled = true input.disabled = true
lightdm.respond(this._password) if (username == accounts._guestAccount && lightdm.has_guest_account) {
lightdm.authenticate_as_guest()
} else {
lightdm.respond(this._password)
}
} }
startAuthentication() { startAuthentication() {
lightdm.cancel_authentication() lightdm.cancel_authentication()
let username = accounts.getDefaultUserName()
if (username == accounts._guestAccount && lightdm.has_guest_account) return
lightdm.authenticate(String(accounts.getDefaultUserName())) lightdm.authenticate(String(accounts.getDefaultUserName()))
} }
async _authentication_done() { async _authentication_done() {
var form = document.querySelector("#login-form") var form = document.querySelector("#login-form")
var input = document.querySelector("#input-password")
form.classList.add("success") form.classList.add("success")
await wait(500) await wait(500)

Loading…
Cancel
Save