password protect

This commit is contained in:
David Botton 2024-06-14 14:06:53 -04:00
parent 250d8129d2
commit e443a34dc5
5 changed files with 224 additions and 195 deletions

View file

@ -1914,6 +1914,7 @@ alert-dialog blocks till time-out reached or OK clicked."
(rows 1)
(placeholder-value "")
(default-value "")
is-password
(left nil) (top nil)
(width 300) (height 200)
(client-movement nil)
@ -1928,7 +1929,10 @@ result of on-input."
(result nil)
(body (connection-body obj))
(inp (if (eql rows 1)
(format nil "<input type='text' id='~A-input' size='~A' value='~A' placeholder='~A'>"
(format nil "<input type='~A' id='~A-input' size='~A' value='~A' placeholder='~A'>"
(if is-password
"password"
"text")
html-id
size
(escape-string default-value :html t)

View file

@ -10,6 +10,9 @@
;; These are defaults, if the file preferences.lisp exists
;; the values set there will be used instead
;; To passowrod protect use of the IDE set to a password or a function that
;; returns a password.
(defparameter *password-protect* nil)
;; Open panels and files in new browser tabs by default
(defparameter *open-external* nil)
;; Use clog-popup and extend desktop to popups

View file

@ -334,6 +334,7 @@ clog-builder window.")
(*menu-window-select-class* *builder-menu-window-select-class*)
(*default-title-class* *builder-title-class*)
(*default-border-class* *builder-border-class*)
(safe t)
(open-file (form-data-item (form-get-data body) "open-file"))
(open-panel (form-data-item (form-get-data body) "open-panel"))
(open-ext (form-data-item (form-get-data body) "open-ext")))
@ -347,6 +348,15 @@ clog-builder window.")
(make-instance 'console-in-stream :clog-obj body)))
(clog-gui-initialize body :use-clog-debugger t :standard-output (stdout app))
(add-class body *builder-window-desktop-class*)
(when *password-protect*
(input-dialog body "Enter password:" (lambda (result)
(unless (equal result (if (functionp *password-protect*)
(funcall *password-protect* body)
*password-protect*))
(setf safe nil)
(close-connection (window body))))
:time-out 360 :title "Password"))
(when safe
(with-clog-debugger (body :standard-output (stdout app))
(when *builder-window-show-static-root-class*
(setf (z-index (create-panel body :positioning :fixed
@ -531,7 +541,7 @@ clog-builder window.")
"")))
(when *app-mode*
(incf *app-mode*))
(run body))
(run body)))
(when (eq *clog-debug-instance* body)
(setf *clog-debug-instance* nil))
(when *app-mode*
@ -633,9 +643,10 @@ PATHNAME. Current format is one native namestring per line."
(setf pathname (truename pathname))
(with-open-file (stream (system-index-file pathname)
:direction :output
:if-exists :overwrite)
:if-exists :nil)
(when stream
(dolist (system-file (local-project-system-files pathname))
(let ((system-path (enough-namestring system-file pathname)))
(write-line (native-namestring system-path) stream)))
(probe-file stream)))
(probe-file stream))))

View file

@ -175,6 +175,13 @@
(setf (title (html-document body)) "CLOG DB Admin")
(clog-gui-initialize body)
(add-class body "w3-blue-grey")
(when *password-protect*
(input-dialog body "Enter password:" (lambda (result)
(unless (equal result (if (functionp *password-protect*)
(funcall *password-protect* body)
*password-protect*))
(close-connection (window body))))
:time-out 360 :title "Password"))
(let* ((menu (create-gui-menu-bar body))
(icon (create-gui-menu-icon menu :on-click #'on-help-about))
(file (create-gui-menu-drop-down menu :content "Database"))

View file

@ -23,6 +23,10 @@
;; CLOG Builder Desktop
;; To password protect use of the IDE set to a password or a function that
;; returns a password (lambda clog-body)
(setf *password-protect* nil)
;; Open panels and files in new browser tabs by default
(setf *open-external* nil)
;; Use clog-popup and extend desktop to popups