Browse code
feat: mfa
Ed Langley authored on 29/10/2020 21:29:47
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -1,5 +1,17 @@ |
1 | 1 |
(in-package :mfa-tool) |
2 | 2 |
|
3 |
+(defun get-mfa (_ interface) |
|
4 |
+ (declare (ignore _)) |
|
5 |
+ (capi:apply-in-pane-process |
|
6 |
+ (mfa-input interface) |
|
7 |
+ (lambda () |
|
8 |
+ (setf (capi:text-input-pane-text (mfa-input interface)) |
|
9 |
+ (format nil "~6,'0d" |
|
10 |
+ (cl-totp:totp |
|
11 |
+ (serapeum:trim-whitespace |
|
12 |
+ (alexandria:read-file-into-string "~/.fwoar.co"))))) |
|
13 |
+ (go-on _ interface)))) |
|
14 |
+ |
|
3 | 15 |
(capi:define-interface mfa-tool () |
4 | 16 |
((assumed-credentials :accessor assumed-credentials :initform (make-hash-table :test 'equal)) |
5 | 17 |
(%default-account :initarg :default-account :reader default-account) |
... | ... |
@@ -10,6 +22,7 @@ |
10 | 22 |
:visible-min-width (list :character 80) |
11 | 23 |
:visible-min-height (list :character 25)) |
12 | 24 |
(go-button capi:push-button :text "Go!" :callback 'go-on) |
25 |
+ (mfa-button capi:push-button :text "MFA" :callback 'get-mfa) |
|
13 | 26 |
(mfa-input capi:text-input-pane |
14 | 27 |
:title "MFA Token:" |
15 | 28 |
:title-position :left |
... | ... |
@@ -62,8 +75,10 @@ |
62 | 75 |
:callback-type :data-interface)) |
63 | 76 |
(:layouts |
64 | 77 |
(button-layout capi:row-layout |
65 |
- '(nil |
|
66 |
- go-button)) |
|
78 |
+ (append '(nil) |
|
79 |
+ (when (probe-file "~/.fwoar.co") |
|
80 |
+ (list 'mfa-button)) |
|
81 |
+ '(go-button))) |
|
67 | 82 |
(data-layout capi:column-layout |
68 | 83 |
'(account-selector |
69 | 84 |
role-selector |