|
1
|
|
|
// Code generated by templ - DO NOT EDIT. |
|
2
|
|
|
|
|
3
|
|
|
// templ: version: v0.2.598 |
|
4
|
|
|
package components |
|
5
|
|
|
|
|
6
|
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present. |
|
7
|
|
|
|
|
8
|
|
|
import "github.com/a-h/templ" |
|
9
|
|
|
import "context" |
|
10
|
|
|
import "io" |
|
11
|
|
|
import "bytes" |
|
12
|
|
|
|
|
13
|
|
|
import "strconv" |
|
14
|
|
|
|
|
15
|
|
|
func RegisterComponent() templ.Component { |
|
16
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
|
17
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
|
18
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
19
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
|
20
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
|
21
|
|
|
} |
|
22
|
|
|
ctx = templ.InitializeContext(ctx) |
|
23
|
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
|
24
|
|
|
if templ_7745c5c3_Var1 == nil { |
|
25
|
|
|
templ_7745c5c3_Var1 = templ.NopComponent |
|
26
|
|
|
} |
|
27
|
|
|
ctx = templ.ClearChildren(ctx) |
|
28
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col gap-4 p-4 md:p-8\" data-testid=\"registerComponent\"><form hx-post=\"/register\" hx-swap=\"outerHTML\"><div class=\"\" hx-target=\"this\"><label class=\"label\"><span id=\"email-error\" class=\"label-text\">Email</span></label> <input class=\"input-bordered input w-full transition duration-100\" placeholder=\"Enter your email\" type=\"email\" name=\"email\" required maxlength=\"254\"></div><div class=\"\" hx-target=\"this\"><label class=\"label\"><span id=\"username-error\" class=\"label-text\">Username</span></label> <input class=\"input-bordered input w-full transition duration-100\" placeholder=\"Enter your username\" required maxlength=\"50\" minlength=\"3\" type=\"username\" name=\"username\"></div><div class=\"\"><label class=\"label\"><span id=\"password-error\" class=\"label-text\">Password</span></label> <input class=\"input-bordered input w-full transition duration-100\" hx-post=\"/register/password\" hx-trigger=\"input changed delay:500ms\" hx-swap=\"afterend\" placeholder=\"Enter your password\" type=\"password\" name=\"password\" minlength=\"10\" maxlength=\"72\" required><div id=\"password-entropy\"><span class=\"label-text\">Strength of password</span> <progress id=\"pb\" class=\"progress progress-error w-full\" value=\"6\" max=\"100\"></progress></div></div><div class=\"pt-6\"><button class=\"btn-primary btn transition duration-100 w-full\">Register</button></div></form></div>") |
|
29
|
|
|
if templ_7745c5c3_Err != nil { |
|
30
|
|
|
return templ_7745c5c3_Err |
|
31
|
|
|
} |
|
32
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
33
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
|
34
|
|
|
} |
|
35
|
|
|
return templ_7745c5c3_Err |
|
36
|
|
|
}) |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
func UsernameError(err string) templ.Component { |
|
40
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
|
41
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
|
42
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
43
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
|
44
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
|
45
|
|
|
} |
|
46
|
|
|
ctx = templ.InitializeContext(ctx) |
|
47
|
|
|
templ_7745c5c3_Var2 := templ.GetChildren(ctx) |
|
48
|
|
|
if templ_7745c5c3_Var2 == nil { |
|
49
|
|
|
templ_7745c5c3_Var2 = templ.NopComponent |
|
50
|
|
|
} |
|
51
|
|
|
ctx = templ.ClearChildren(ctx) |
|
52
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"#username-error\" hx-swap-oob=\"true\" class=\"text-red-500 text-xs mt-1\">Username - ") |
|
53
|
|
|
if templ_7745c5c3_Err != nil { |
|
54
|
|
|
return templ_7745c5c3_Err |
|
55
|
|
|
} |
|
56
|
|
|
var templ_7745c5c3_Var3 string |
|
57
|
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(err) |
|
58
|
|
|
if templ_7745c5c3_Err != nil { |
|
59
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/components/register.component.templ`, Line: 65, Col: 96} |
|
60
|
|
|
} |
|
61
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) |
|
62
|
|
|
if templ_7745c5c3_Err != nil { |
|
63
|
|
|
return templ_7745c5c3_Err |
|
64
|
|
|
} |
|
65
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>") |
|
66
|
|
|
if templ_7745c5c3_Err != nil { |
|
67
|
|
|
return templ_7745c5c3_Err |
|
68
|
|
|
} |
|
69
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
70
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
|
71
|
|
|
} |
|
72
|
|
|
return templ_7745c5c3_Err |
|
73
|
|
|
}) |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
func PasswordEntropy(value float64, err error) templ.Component { |
|
77
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
|
78
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
|
79
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
80
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
|
81
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
|
82
|
|
|
} |
|
83
|
|
|
ctx = templ.InitializeContext(ctx) |
|
84
|
|
|
templ_7745c5c3_Var4 := templ.GetChildren(ctx) |
|
85
|
|
|
if templ_7745c5c3_Var4 == nil { |
|
86
|
|
|
templ_7745c5c3_Var4 = templ.NopComponent |
|
87
|
|
|
} |
|
88
|
|
|
ctx = templ.ClearChildren(ctx) |
|
89
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"password-entropy\" hx-swap-oob=\"true\"><span class=\"label-text\">Strength of password</span> ") |
|
90
|
|
|
if templ_7745c5c3_Err != nil { |
|
91
|
|
|
return templ_7745c5c3_Err |
|
92
|
|
|
} |
|
93
|
|
|
var templ_7745c5c3_Var5 = []any{"progress w-full transition-all ease-out duration-[6s]", templ.KV("progress-error", value < 72), |
|
94
|
|
|
templ.KV("progress-warning", value >= 72 && value < 80), templ.KV("progress-success", value >= 80)} |
|
95
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...) |
|
96
|
|
|
if templ_7745c5c3_Err != nil { |
|
97
|
|
|
return templ_7745c5c3_Err |
|
98
|
|
|
} |
|
99
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<progress id=\"pb\" class=\"") |
|
100
|
|
|
if templ_7745c5c3_Err != nil { |
|
101
|
|
|
return templ_7745c5c3_Err |
|
102
|
|
|
} |
|
103
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ.CSSClasses(templ_7745c5c3_Var5).String())) |
|
104
|
|
|
if templ_7745c5c3_Err != nil { |
|
105
|
|
|
return templ_7745c5c3_Err |
|
106
|
|
|
} |
|
107
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" value=\"") |
|
108
|
|
|
if templ_7745c5c3_Err != nil { |
|
109
|
|
|
return templ_7745c5c3_Err |
|
110
|
|
|
} |
|
111
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(strconv.Itoa(int(value)))) |
|
112
|
|
|
if templ_7745c5c3_Err != nil { |
|
113
|
|
|
return templ_7745c5c3_Err |
|
114
|
|
|
} |
|
115
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" max=\"100\"></progress> ") |
|
116
|
|
|
if templ_7745c5c3_Err != nil { |
|
117
|
|
|
return templ_7745c5c3_Err |
|
118
|
|
|
} |
|
119
|
|
|
if err != nil { |
|
120
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span class=\"text-xs text-gray-500\">") |
|
121
|
|
|
if templ_7745c5c3_Err != nil { |
|
122
|
|
|
return templ_7745c5c3_Err |
|
123
|
|
|
} |
|
124
|
|
|
var templ_7745c5c3_Var6 string |
|
125
|
|
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(err.Error()) |
|
126
|
|
|
if templ_7745c5c3_Err != nil { |
|
127
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/components/register.component.templ`, Line: 80, Col: 17} |
|
128
|
|
|
} |
|
129
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) |
|
130
|
|
|
if templ_7745c5c3_Err != nil { |
|
131
|
|
|
return templ_7745c5c3_Err |
|
132
|
|
|
} |
|
133
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span>") |
|
134
|
|
|
if templ_7745c5c3_Err != nil { |
|
135
|
|
|
return templ_7745c5c3_Err |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>") |
|
139
|
|
|
if templ_7745c5c3_Err != nil { |
|
140
|
|
|
return templ_7745c5c3_Err |
|
141
|
|
|
} |
|
142
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
143
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
|
144
|
|
|
} |
|
145
|
|
|
return templ_7745c5c3_Err |
|
146
|
|
|
}) |
|
147
|
|
|
} |
|
148
|
|
|
|