mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add update user profile back end, add new gitignore and license, add template data to public profile page
This commit is contained in:
@@ -17,9 +17,31 @@ import (
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
func Setting(r render.Render, data base.TmplData, session sessions.Session) {
|
||||
func Setting(form auth.UpdateProfileForm, r render.Render, data base.TmplData, req *http.Request, session sessions.Session) {
|
||||
data["Title"] = "Setting"
|
||||
data["PageIsUserSetting"] = true
|
||||
|
||||
user := auth.SignedInUser(session)
|
||||
if req.Method == "GET" {
|
||||
data["Owner"] = user
|
||||
}
|
||||
|
||||
if hasErr, ok := data["HasError"]; ok && hasErr.(bool) {
|
||||
r.HTML(200, "user/setting", data)
|
||||
return
|
||||
}
|
||||
|
||||
user.Email = form.Email
|
||||
user.Website = form.Website
|
||||
user.Location = form.Location
|
||||
user.Avatar = base.EncodeMd5(form.Avatar)
|
||||
if err := models.UpdateUser(user); err != nil {
|
||||
data["ErrorMsg"] = err
|
||||
log.Error("setting.Setting: %v", err)
|
||||
r.HTML(200, "base/error", data)
|
||||
return
|
||||
}
|
||||
|
||||
r.HTML(200, "user/setting", data)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user