cl-scopes/lib/auth/web.lisp

29 lines
1 KiB
Common Lisp

;;;; cl-scopes/lib/auth/web - authentication web interface
(defpackage :scopes-auth/web
(:use :common-lisp)
(:local-nicknames (:actor :scopes/core/actor)
(:auth :scopes-auth)
(:config :scopes/config)
(:core :scopes/core)
(:jwt :scopes/web/jwt)
(:message :scopes/core/message)
(:server :scopes/web/server)
(:shape :scopes/shape)
(:util :scopes/util))
(:export #:login #:login-form))
(in-package :scopes-auth/web)
(defun login-form (ctx msg)
(let ((msg (message:create '(:html :render :form :login)
:data '(:fields (:login :password) :button "Login")
:customer (actor:customer msg))))
(core:echo ctx msg)))
(defun login (ctx msg)
(let* ((prc (auth:login (shape:data msg))))
;(jwt:create ...)
;(server:set-cookie ctx ...)
;(core:echo ctx ...) ; render htmx response
(core:echo ctx msg)))