Browse code
feature: begin to sketch invalid token dialog
Edward Langley authored on 30/09/2019 07:36:40
Showing 2 changed files
Showing 2 changed files
7 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,39 @@ |
1 |
+(in-package :mfa-tool) |
|
2 |
+ |
|
3 |
+(capi:define-interface reauth-interface () |
|
4 |
+ ((error-message :initarg :error-message) |
|
5 |
+ (auth-user :initarg :auth-user)) |
|
6 |
+ (:panes (error-display capi:display-pane |
|
7 |
+ :background :transparent |
|
8 |
+ :text error-message) |
|
9 |
+ (user-input capi:text-input-pane |
|
10 |
+ :title "User:" |
|
11 |
+ :title-position :left |
|
12 |
+ :title-args '(:visible-min-width (:character 10)) |
|
13 |
+ :text auth-user |
|
14 |
+ :reader user-input) |
|
15 |
+ (mfa-input capi:text-input-pane |
|
16 |
+ :title "MFA Token:" |
|
17 |
+ :title-position :left |
|
18 |
+ :max-characters 6 |
|
19 |
+ :title-args '(:visible-min-width (:character 10)) |
|
20 |
+ :reader mfa-input)) |
|
21 |
+ (:layouts (main-layout capi:column-layout |
|
22 |
+ '(error-display |
|
23 |
+ nil |
|
24 |
+ user-input |
|
25 |
+ mfa-input) |
|
26 |
+ :visible-min-width '(:character 50) |
|
27 |
+ :adjust :center)) |
|
28 |
+ |
|
29 |
+ (:default-initargs |
|
30 |
+ :layout 'main-layout)) |
|
31 |
+ |
|
32 |
+(defun reauth-result (reauth-interface) |
|
33 |
+ (let ((result (list (capi:text-input-pane-text (user-input reauth-interface)) |
|
34 |
+ (capi:text-input-pane-text (mfa-input reauth-interface))))) |
|
35 |
+ (if (and (position #\@ (first result)) |
|
36 |
+ (every 'digit-char-p (second result)) |
|
37 |
+) |
|
38 |
+ result |
|
39 |
+ (values result t)))) |