mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 18:04:04 +01:00
more
This commit is contained in:
parent
aadd7dcdc3
commit
b7bf9dfd28
3 changed files with 4 additions and 4 deletions
|
@ -101,8 +101,8 @@ func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AVATAR_LOCAL string = "local"
|
AvatarLocal string = "local"
|
||||||
AVATAR_BYMAIL string = "bymail"
|
AvatarByMail string = "bymail"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AvatarForm struct {
|
type AvatarForm struct {
|
||||||
|
|
|
@ -84,7 +84,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingsAvatar(ctx *context.Context, form auth.AvatarForm) {
|
func SettingsAvatar(ctx *context.Context, form auth.AvatarForm) {
|
||||||
form.Source = auth.AVATAR_LOCAL
|
form.Source = auth.AvatarLocal
|
||||||
if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil {
|
if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -104,7 +104,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
|
||||||
|
|
||||||
// FIXME: limit size.
|
// FIXME: limit size.
|
||||||
func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *models.User) error {
|
func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *models.User) error {
|
||||||
ctxUser.UseCustomAvatar = form.Source == auth.AVATAR_LOCAL
|
ctxUser.UseCustomAvatar = form.Source == auth.AvatarLocal
|
||||||
if len(form.Gravatar) > 0 {
|
if len(form.Gravatar) > 0 {
|
||||||
ctxUser.Avatar = base.EncodeMD5(form.Gravatar)
|
ctxUser.Avatar = base.EncodeMD5(form.Gravatar)
|
||||||
ctxUser.AvatarEmail = form.Gravatar
|
ctxUser.AvatarEmail = form.Gravatar
|
||||||
|
|
Loading…
Reference in a new issue