Added page protection for unauthorized access

This commit is contained in:
2025-02-14 19:51:40 +11:00
parent 5616b8a248
commit ea4dd2a407
8 changed files with 107 additions and 15 deletions

View File

@@ -10,7 +10,8 @@ templ RegisterForm(registerError string) {
errPasswords := "false"
if registerError == "Username is taken" {
errUsername = "true"
} else if registerError == "Passwords do not match" {
} else if registerError == "Passwords do not match" ||
registerError == "Password exceeds maximum length of 72 bytes" {
errPasswords = "true"
}
xdata := fmt.Sprintf(

13
view/page/profile.templ Normal file
View File

@@ -0,0 +1,13 @@
package page
import "projectreshoot/view/layout"
import "projectreshoot/contexts"
templ Profile() {
{{ user := contexts.GetUser(ctx) }}
@layout.Global() {
<div class="">
Hello, { user.Username }
</div>
}
}