Skip to content

Commit

Permalink
chore: allow changing name in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
taciturnaxolotl committed Sep 26, 2024
1 parent 6f3515f commit a2c013c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type CredentialsReset struct {
}

type UserDataUpdate struct {
Name string `schema:"name"`
Email string `schema:"email"`
Location string `schema:"location"`
ReportsWeekly bool `schema:"reports_weekly"`
Expand Down
1 change: 1 addition & 0 deletions routes/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ func (h *SettingsHandler) actionUpdateUser(w http.ResponseWriter, r *http.Reques
return actionResult{http.StatusBadRequest, "", "cannot unset email while subscription is active", nil}
}

user.Name = payload.Name
user.Email = payload.Email
user.Location = payload.Location
user.ReportsWeekly = payload.ReportsWeekly
Expand Down
2 changes: 1 addition & 1 deletion views/menu-main.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
></span>
{{ end }}
<a class="text-text-secondary dark:text-text-dark-secondary"
>{{ .SharedLoggedInViewModel.User.ID }}</a
>{{ .SharedLoggedInViewModel.User.Name }}</a
>
</div>
{{ if .SharedLoggedInViewModel.User.Email }}
Expand Down
25 changes: 25 additions & 0 deletions views/settings.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,31 @@
</div>
</div>

<div class="flex mb-8">
<div class="w-1/2 mr-4 inline-block">
<label
class="font-semibold text-text-primary dark:text-text-dark-primary"
for="name"
>Name</label
>
<span
class="block text-sm text-text-secondary dark:text-text-dark-secondary"
>
Optional but you can customize it :)
</span>
</div>
<div class="w-1/2 ml-4">
<input
class="input-default"
type="name"
id="name"
name="name"
placeholder="Enter your name"
value="{{ .User.Name }}"
/>
</div>
</div>

<div class="flex mb-8">
<div class="w-1/2 mr-4 inline-block">
<label
Expand Down

0 comments on commit a2c013c

Please sign in to comment.