commit
cc08aa8080
4 changed files with 37 additions and 28 deletions
|
@ -12,6 +12,6 @@ bin = @["hh1"]
|
|||
# Dependencies
|
||||
|
||||
requires "nim >= 2.0.8"
|
||||
requires "https://github.com/ire4ever1190/mike >= 1.3.3"
|
||||
requires "nimja"
|
||||
requires "https://codeberg.org/13thab/turso-nim"
|
||||
# requires "https://github.com/ire4ever1190/mike >= 1.3.3"
|
||||
# requires "nimja"
|
||||
# requires "https://codeberg.org/13thab/turso-nim"
|
28
src/controller/htmx.nim
Normal file
28
src/controller/htmx.nim
Normal file
|
@ -0,0 +1,28 @@
|
|||
import
|
||||
mike,
|
||||
../model/rand,
|
||||
../lib/htmx
|
||||
|
||||
proc htmxEmail*(ctx:Context)=
|
||||
var
|
||||
em = ctx.urlForm["email"]
|
||||
val: Validity
|
||||
if em == "":
|
||||
val.message = "Last Name is Required"
|
||||
val.mark = "is-invalid"
|
||||
else:
|
||||
val.message = ""
|
||||
val.mark = ""
|
||||
ctx.send htmxEmail(em, val)
|
||||
|
||||
proc htmxPassword*(ctx:Context)=
|
||||
var
|
||||
pw = ctx.urlForm["password"]
|
||||
val: Validity
|
||||
if pw == "":
|
||||
val.message = "Last Name is Required"
|
||||
val.mark = "is-invalid"
|
||||
else:
|
||||
val.message = ""
|
||||
val.mark = ""
|
||||
ctx.send htmxPassword(pw, val)
|
28
src/hh1.nim
28
src/hh1.nim
|
@ -1,5 +1,5 @@
|
|||
import
|
||||
mike,
|
||||
mike,
|
||||
nimja,
|
||||
strutils,
|
||||
json,
|
||||
|
@ -9,7 +9,7 @@ import
|
|||
./lib/[mics, htmx],
|
||||
./db/users,
|
||||
./model/[model, rand],
|
||||
./controller/[signup, login]
|
||||
./controller/[signup, login, htmx]
|
||||
|
||||
load()
|
||||
|
||||
|
@ -71,29 +71,9 @@ load()
|
|||
|
||||
"/htmx/login" -> post: ctx.htmxLogin()
|
||||
|
||||
"/htmx/email" -> post:
|
||||
var
|
||||
em = ctx.urlForm["email"]
|
||||
val: Validity
|
||||
if em == "":
|
||||
val.message = "Last Name is Required"
|
||||
val.mark = "is-invalid"
|
||||
else:
|
||||
val.message = ""
|
||||
val.mark = ""
|
||||
ctx.send htmxEmail(em, val)
|
||||
"/htmx/email" -> post: htmxEmail(ctx)
|
||||
|
||||
"/htmx/password" -> post:
|
||||
var
|
||||
pw = ctx.urlForm["password"]
|
||||
val: Validity
|
||||
if pw == "":
|
||||
val.message = "Last Name is Required"
|
||||
val.mark = "is-invalid"
|
||||
else:
|
||||
val.message = ""
|
||||
val.mark = ""
|
||||
ctx.send htmxPassword(pw, val)
|
||||
"/htmx/password" -> post: htmxPassword(ctx)
|
||||
|
||||
"/:path" -> get:
|
||||
var
|
||||
|
|
|
@ -2,4 +2,5 @@ type
|
|||
Validity* = object
|
||||
name*: string
|
||||
message*: string
|
||||
mark*: string
|
||||
mark*: string
|
||||
|
Loading…
Reference in a new issue