modularised webserver and auth systems
This commit is contained in:
@@ -3,11 +3,11 @@ package account
|
||||
import "projectreshoot/pkg/contexts"
|
||||
|
||||
templ ChangeUsername(err string, username string) {
|
||||
{{ user := contexts.CurrentUser(ctx) }}
|
||||
{{
|
||||
user := contexts.GetUser(ctx)
|
||||
if username == "" {
|
||||
username = user.Username
|
||||
}
|
||||
if username == "" {
|
||||
username = user.Username
|
||||
}
|
||||
}}
|
||||
<form
|
||||
hx-post="/change-username"
|
||||
@@ -18,18 +18,18 @@ templ ChangeUsername(err string, username string) {
|
||||
).CallInline }
|
||||
>
|
||||
<script>
|
||||
function usernameComponent(newUsername, oldUsername, err) {
|
||||
return {
|
||||
username: newUsername,
|
||||
initialUsername: oldUsername,
|
||||
err: err,
|
||||
resetUsername() {
|
||||
this.username = this.initialUsername;
|
||||
this.err = "";
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
function usernameComponent(newUsername, oldUsername, err) {
|
||||
return {
|
||||
username: newUsername,
|
||||
initialUsername: oldUsername,
|
||||
err: err,
|
||||
resetUsername() {
|
||||
this.username = this.initialUsername;
|
||||
this.err = "";
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<div
|
||||
class="flex flex-col sm:flex-row"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user