diff --git a/src/htmx.v b/src/htmx.v index 92438fc..ae66a1b 100644 --- a/src/htmx.v +++ b/src/htmx.v @@ -19,4 +19,32 @@ fn htmx_get_username(input HTMX) string { value="${input.name}" /> ' +} + +fn htmx_get_email(input HTMX) string { + return ' +
+ + +
' +} + +fn htmx_get_password(input HTMX) string { + return ' +
+ + +
' } \ No newline at end of file diff --git a/src/templates/login.html b/src/templates/login.html index f067482..7bc27ae 100644 --- a/src/templates/login.html +++ b/src/templates/login.html @@ -4,20 +4,33 @@ Log In @css 'https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css' + + @js 'https://unpkg.com/htmx.org@2.0.0'

Welcome Back!

-
- - - +
+ +
-
+
- +
diff --git a/src/view.v b/src/view.v index 3eac682..712b6d6 100644 --- a/src/view.v +++ b/src/view.v @@ -19,4 +19,34 @@ pub fn (mut app App) htmx_username(username string) vweb.Result{ return app.text(htmx_get_username(htmx)) } return app.text(htmx_get_username(htmx)) +} + +@['/htmx/email'; post] +pub fn (mut app App) htmx_email(email string) vweb.Result{ + mut htmx := HTMX{ + name: email, + message: "", + mark: "" + } + if email == '' { + htmx.message = "email cannot be empty" + htmx.mark = 'style="border: 2px solid #e74c3c;"' + return app.text(htmx_get_email(htmx)) + } + return app.text(htmx_get_email(htmx)) +} + +@['/htmx/password'; post] +pub fn (mut app App) htmx_password(password string) vweb.Result{ + mut htmx := HTMX{ + name: password, + message: "", + mark: "" + } + if password == '' { + htmx.message = "password cannot be empty" + htmx.mark = 'style="border: 2px solid #e74c3c;"' + return app.text(htmx_get_password(htmx)) + } + return app.text(htmx_get_password(htmx)) } \ No newline at end of file