login_templ.go 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Code generated by templ - DO NOT EDIT.
  2. // templ: version: v0.3.1020
  3. package views
  4. //lint:file-ignore SA4006 This context is only used if a nested component is present.
  5. import "github.com/a-h/templ"
  6. import templruntime "github.com/a-h/templ/runtime"
  7. // Login renders the standalone login page (no nav layout).
  8. func Login(flashErr string) templ.Component {
  9. return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
  10. templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
  11. if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
  12. return templ_7745c5c3_CtxErr
  13. }
  14. templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
  15. if !templ_7745c5c3_IsBuffer {
  16. defer func() {
  17. templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
  18. if templ_7745c5c3_Err == nil {
  19. templ_7745c5c3_Err = templ_7745c5c3_BufErr
  20. }
  21. }()
  22. }
  23. ctx = templ.InitializeContext(ctx)
  24. templ_7745c5c3_Var1 := templ.GetChildren(ctx)
  25. if templ_7745c5c3_Var1 == nil {
  26. templ_7745c5c3_Var1 = templ.NopComponent
  27. }
  28. ctx = templ.ClearChildren(ctx)
  29. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Login — JamTrack</title><link rel=\"stylesheet\" href=\"/static/bulma.min.css\"></head><body><section class=\"section\"><div class=\"container\"><div class=\"columns is-centered\"><div class=\"column is-narrow\" style=\"min-width:320px\"><h1 class=\"title has-text-centered\">JamTrack</h1>")
  30. if templ_7745c5c3_Err != nil {
  31. return templ_7745c5c3_Err
  32. }
  33. if flashErr != "" {
  34. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<div class=\"notification is-danger is-light\">")
  35. if templ_7745c5c3_Err != nil {
  36. return templ_7745c5c3_Err
  37. }
  38. var templ_7745c5c3_Var2 string
  39. templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(flashErr)
  40. if templ_7745c5c3_Err != nil {
  41. return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 20, Col: 63}
  42. }
  43. _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
  44. if templ_7745c5c3_Err != nil {
  45. return templ_7745c5c3_Err
  46. }
  47. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</div>")
  48. if templ_7745c5c3_Err != nil {
  49. return templ_7745c5c3_Err
  50. }
  51. }
  52. templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<form method=\"POST\" action=\"/login\"><div class=\"field\"><label class=\"label\">Username</label><div class=\"control\"><input class=\"input\" type=\"text\" name=\"username\" autofocus required></div></div><div class=\"field\"><label class=\"label\">Password</label><div class=\"control\"><input class=\"input\" type=\"password\" name=\"password\" required></div></div><div class=\"field mt-4\"><div class=\"control\"><button class=\"button is-primary is-fullwidth\" type=\"submit\">Sign in</button></div></div></form></div></div></div></section></body></html>")
  53. if templ_7745c5c3_Err != nil {
  54. return templ_7745c5c3_Err
  55. }
  56. return nil
  57. })
  58. }
  59. var _ = templruntime.GeneratedTemplate