diff options
| author | unwox <me@unwox.com> | 2025-09-16 17:21:51 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-09-19 14:54:41 +0600 |
| commit | b3fd9c6aad5828fae482794f3719c40a3dceb72e (patch) | |
| tree | b0154502f04c8dd7f2366ebd388eda481ea039a6 | |
| parent | 1df376b3b7b1e77de2730fa93f499083116baf4f (diff) | |
small improvements
| -rw-r--r-- | dicts.fnl | 8 | ||||
| -rw-r--r-- | pages/auth.fnl | 40 | ||||
| -rw-r--r-- | static/style.css | 2 |
3 files changed, 25 insertions, 25 deletions
@@ -1,12 +1,12 @@ (local product-type - [{:value "white" :label "Белый"} + [{:value "white" :label "Белый чай"} {:value "dark-oolong" :label "Темный улун"} {:value "light-oolong" :label "Светлый улун"} - {:value "red" :label "Красный"} - {:value "green" :label "Зеленый"} + {:value "red" :label "Красный чай"} + {:value "green" :label "Зеленый чай"} {:value "shu-puerh" :label "Шу пуэр"} {:value "sheng-puerh" :label "Шэн пуэр"} - {:value "yellow" :label "Желтый"} + {:value "yellow" :label "Желтый чай"} {:value "liu-bao" :label "Лю бао"} {:value "teapot" :label "Чайник"}]) diff --git a/pages/auth.fnl b/pages/auth.fnl index c6c1832..3afb517 100644 --- a/pages/auth.fnl +++ b/pages/auth.fnl @@ -3,22 +3,23 @@ (local lib (require :lib)) (local templates (require :templates)) -(local auth-form [ - {:title "" - :fields [ - (forms.text-input "name" "Пользователь" true) - (forms.password-input "password" "Пароль" true)]}]) +(local auth-form + [{:title "" + :fields [ + (forms.text-input "name" "Пользователь" true) + (forms.password-input "password" "Пароль" true)]}]) (fn content [data errors] - (set data.password nil) - [(HTML - [:div {:class "side"} - (templates.header "/auth")]) - (HTML - [:section {:class "content"} - [:div {:class "mb-1"} [:a {:href "/"} "⟵ Обратно на главную"]] - [:h2 {} "Войти"] - (forms.render-form auth-form data errors)])]) + (set data.password nil) + + [(HTML + [:div {:class "side"} + (templates.header "/auth")]) + (HTML + [:section {:class "content"} + [:div {:class "mb-1"} [:a {:href "/"} "⟵ Обратно на главную"]] + [:h2 {} "Войти"] + (forms.render-form auth-form data errors)])]) (fn create-session [db user expires-at] (local id (_G.must (luna.crypto.random-string 64))) @@ -27,7 +28,6 @@ db "INSERT INTO auth_sessions (id, user, creation_time, expires_at) VALUES (?, ?, ?, ?)" [id user (lib.now) expires-at])) - id) (fn check-user [db name entered-pass] @@ -50,10 +50,7 @@ (if request.form (let [name request.form.name entered-password request.form.password - correct-creds? (check-user db name entered-password) - errors (if (not correct-creds?) - {:password "Пользователя с таким именем и паролем не существует."} - nil)] + correct-creds? (check-user db name entered-password)] (if correct-creds? (let [next-week (+ (os.time) (* 60 60 24 7)) session-id (create-session @@ -63,7 +60,10 @@ :Set-Cookie (.. "auth= " session-id "; HttpOnly; SameSite=strict;" "Expires=" cookie-expires (if luna.debug? "" "; Secure"))} "")) - (values 200 {} (templates.base (content request.form errors))))) + (values 400 {} + (templates.base + (content request.form + {:password "Пользователя с таким именем и паролем не существует."}))))) (values 200 {} (templates.base (content {} {})))))) {: render} diff --git a/static/style.css b/static/style.css index ccdd08d..a152c1b 100644 --- a/static/style.css +++ b/static/style.css @@ -171,7 +171,7 @@ nav a.active { } .logo::before { - animation: infinite logo-rotation 120s; + animation: infinite linear logo-rotation 120s; background-image: url("/static/logo-bg.png"); background-repeat: no-repeat; background-size: cover; |
