diff options
author | Aylur <[email protected]> | 2024-09-01 03:19:31 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-09-01 03:19:31 +0200 |
commit | 15408c67ea9d2e09fd6e2bbbabbb166c339673ee (patch) | |
tree | 4837656ef99c1860607efd720b5190377fc92b1a /auth/examples/full_example.js | |
parent | db0409915c8e161eb5e8a04938fb8b24f2393ddd (diff) | |
parent | 6adcd2884ee48ec0b1c8b7486e42b2eeffc48159 (diff) |
merge auth
Diffstat (limited to 'auth/examples/full_example.js')
-rw-r--r-- | auth/examples/full_example.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/auth/examples/full_example.js b/auth/examples/full_example.js new file mode 100644 index 0000000..7359784 --- /dev/null +++ b/auth/examples/full_example.js @@ -0,0 +1,38 @@ +#!/usr/bin/env -S gjs -m + +import Auth from "gi://AstalAuth"; +import GLib from "gi://GLib"; + +const loop = GLib.MainLoop.new(null, false); + +const pam = new Auth.Pam(); +pam.connect("auth-prompt-visible", (p, msg) => { + print(msg); + p.supply_secret(""); +}); +pam.connect("auth-prompt-hidden", (p, msg) => { + print(msg); + p.supply_secret("password"); +}); +pam.connect("auth-info", (p, msg) => { + print(msg); + p.supply_secret(""); +}); +pam.connect("auth-error", (p, msg) => { + print(msg); + p.supply_secret(""); +}); + +pam.connect("success", p => { + print("authentication sucessful"); + loop.quit(); +}); +pam.connect("fail", (p, msg) => { + print(msg); + loop.quit(); +}); + +pam.start_authenticate(); + +loop.runAsync() + |