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. 8
      themes/gruvbox/js/authenticate.js

11
themes/gruvbox/js/accounts.js vendored

@ -35,6 +35,17 @@ class Accounts {
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() {
var dropdown = this._accountsList.querySelector(".dropdown")
dropdown.innerHTML = ""

8
themes/gruvbox/js/authenticate.js vendored

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

Loading…
Cancel
Save