mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-10 21:00:15 -08:00
reset-page-on-authentication-change
This commit is contained in:
parent
fcee7553d1
commit
47057b5000
2 changed files with 20 additions and 9 deletions
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
(defsection @clog-auth (:title "CLOG Auth Objects")
|
(defsection @clog-auth (:title "CLOG Auth Objects")
|
||||||
"CLOG-AUTH - authorization abstraction for CLOG"
|
"CLOG-AUTH - authorization abstraction for CLOG"
|
||||||
(get-authentication-token function)
|
(get-authentication-token function)
|
||||||
(store-authentication-token function)
|
(store-authentication-token function)
|
||||||
(remove-authentication-token function))
|
(remove-authentication-token function)
|
||||||
|
(reset-page-on-authentication-change function))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Implementation - clog-auth
|
;; Implementation - clog-auth
|
||||||
|
|
@ -32,7 +33,7 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun get-authentication-token (body &key auth-path)
|
(defun get-authentication-token (body &key auth-path)
|
||||||
"Retrieve the stored authorization token"
|
"Retrieve the stored authentication token"
|
||||||
(let ((token (storage-element (window body) :local *clog-auth-key*)))
|
(let ((token (storage-element (window body) :local *clog-auth-key*)))
|
||||||
(when (equalp token "null")
|
(when (equalp token "null")
|
||||||
(setf token nil))
|
(setf token nil))
|
||||||
|
|
@ -55,5 +56,15 @@
|
||||||
(defun remove-authentication-token (body)
|
(defun remove-authentication-token (body)
|
||||||
(storage-remove (window body) :local *clog-auth-key*))
|
(storage-remove (window body) :local *clog-auth-key*))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; reset-page-on-authentication-change ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defun reset-page-on-authentication-change (obj)
|
||||||
|
(let ((body (connection-body obj)))
|
||||||
|
(set-on-storage (window body) (lambda (obj data)
|
||||||
|
(set-on-storage (window body) nil)
|
||||||
|
(when (equalp (getf data :key)
|
||||||
|
"clog-auth-token")
|
||||||
|
(reload (location body)))))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,19 +184,19 @@
|
||||||
;; url-replace ;;
|
;; url-replace ;;
|
||||||
;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defgeneric url-replace (clog-window replace-url)
|
(defgeneric url-replace (clog-location replace-url)
|
||||||
(:documentation "Replace browser url, ie a redirection and current URL not
|
(:documentation "Replace browser url, ie a redirection and current URL not
|
||||||
saved in session history and back button will not return to it."))
|
saved in session history and back button will not return to it."))
|
||||||
|
|
||||||
(defmethod url-replace ((obj clog-window) replace-url)
|
(defmethod url-replace ((obj clog-location) replace-url)
|
||||||
(execute obj (format nil "replace('~A')" replace-url)))
|
(execute obj (format nil "replace('~A')" replace-url)))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;
|
||||||
;; url-assign ;;
|
;; url-assign ;;
|
||||||
;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defgeneric url-assign (clog-window assign-url)
|
(defgeneric url-assign (clog-location assign-url)
|
||||||
(:documentation "Assign browser url."))
|
(:documentation "Assign browser url."))
|
||||||
|
|
||||||
(defmethod url-assign ((obj clog-window) assign-url)
|
(defmethod url-assign ((obj clog-location) assign-url)
|
||||||
(execute obj (format nil "assign('~A')" assign-url)))
|
(execute obj (format nil "assign('~A')" assign-url)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue