Add the validation for the /login page.
This commit is contained in:
@@ -28,7 +28,8 @@
|
|||||||
[]
|
[]
|
||||||
(fn [req res]
|
(fn [req res]
|
||||||
(let [session (.-user (.-session req))]
|
(let [session (.-user (.-session req))]
|
||||||
(.render res "login" (-> {:authorized (some? session)}
|
(.render res "login" (-> {:authorized (some? session)
|
||||||
|
:url "/login"}
|
||||||
(clj->js))))))
|
(clj->js))))))
|
||||||
|
|
||||||
(defn login-page-auth-handler-factory
|
(defn login-page-auth-handler-factory
|
||||||
@@ -49,8 +50,11 @@
|
|||||||
(.redirect res "/admin"))
|
(.redirect res "/admin"))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(.redirect res "/")
|
(.render res "login"
|
||||||
))))
|
(-> {:error "Wrong login or password!!!"
|
||||||
|
:url "/login"}
|
||||||
|
(clj->js))))
|
||||||
|
)))
|
||||||
|
|
||||||
(defn logout-page-handler-factory
|
(defn logout-page-handler-factory
|
||||||
[]
|
[]
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white">
|
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white">
|
||||||
Sign in to your account
|
Sign in to your account
|
||||||
</h1>
|
</h1>
|
||||||
|
{{#if error }}
|
||||||
|
<p class="text-xl font-bold leading-tight tracking-tight text-red-600">
|
||||||
|
{{ error }}
|
||||||
|
</p>
|
||||||
|
{{/if}}
|
||||||
<form class="space-y-4 md:space-y-6" action="/login" method="POST">
|
<form class="space-y-4 md:space-y-6" action="/login" method="POST">
|
||||||
<div>
|
<div>
|
||||||
<label for="login" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your login</label>
|
<label for="login" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your login</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user