diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-11-21 10:58:08 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-11-21 10:58:08 -0500 |
commit | 55dfe2c97876a8af5db0fb071f002e33fb686128 (patch) | |
tree | c43f8eb741f1dd69b62888202582e4894a5da66d /cmd | |
parent | 3c3f7c2a56ba18d7210cc40e33e64da5219ef990 (diff) | |
download | gitea-55dfe2c97876a8af5db0fb071f002e33fb686128.tar.gz gitea-55dfe2c97876a8af5db0fb071f002e33fb686128.zip |
custom avatar upload
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/web.go b/cmd/web.go index de222d6fae..c2017a2850 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -94,6 +94,13 @@ func newMacaron() *macaron.Macaron { SkipLogging: !setting.DisableRouterLog, }, )) + m.Use(macaron.Static( + setting.AvatarUploadPath, + macaron.StaticOptions{ + Prefix: "avatars", + SkipLogging: !setting.DisableRouterLog, + }, + )) m.Use(macaron.Renderer(macaron.RenderOptions{ Directory: path.Join(setting.StaticRootPath, "templates"), Funcs: []template.FuncMap{base.TemplateFuncs}, @@ -214,6 +221,7 @@ func runWeb(*cli.Context) { m.Group("/user/settings", func() { m.Get("", user.Settings) m.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost) + m.Post("/avatar", binding.MultipartForm(auth.UploadAvatarForm{}), user.SettingsAvatar) m.Get("/password", user.SettingsPassword) m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost) m.Get("/ssh", user.SettingsSSHKeys) |