summaryrefslogtreecommitdiffstats
path: root/routers/user/setting/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/setting/account.go')
-rw-r--r--routers/user/setting/account.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/routers/user/setting/account.go b/routers/user/setting/account.go
index bcf602c5ed..ff8631bf5b 100644
--- a/routers/user/setting/account.go
+++ b/routers/user/setting/account.go
@@ -168,6 +168,34 @@ func DeleteAccount(ctx *context.Context) {
}
}
+// UpdateUIThemePost is used to update users' specific theme
+func UpdateUIThemePost(ctx *context.Context, form auth.UpdateThemeForm) {
+
+ ctx.Data["Title"] = ctx.Tr("settings")
+ ctx.Data["PageIsSettingsAccount"] = true
+
+ if ctx.HasError() {
+ ctx.Redirect(setting.AppSubURL + "/user/settings/account")
+ return
+ }
+
+ if !form.IsThemeExists() {
+ ctx.Flash.Error(ctx.Tr("settings.theme_update_error"))
+ ctx.Redirect(setting.AppSubURL + "/user/settings/account")
+ return
+ }
+
+ if err := ctx.User.UpdateTheme(form.Theme); err != nil {
+ ctx.Flash.Error(ctx.Tr("settings.theme_update_error"))
+ ctx.Redirect(setting.AppSubURL + "/user/settings/account")
+ return
+ }
+
+ log.Trace("Update user theme: %s", ctx.User.Name)
+ ctx.Flash.Success(ctx.Tr("settings.theme_update_success"))
+ ctx.Redirect(setting.AppSubURL + "/user/settings/account")
+}
+
func loadAccountData(ctx *context.Context) {
emails, err := models.GetEmailAddresses(ctx.User.ID)
if err != nil {