restrict v7
This commit is contained in:
@@ -91,12 +91,12 @@ func UpdateProfile(ctx context.Context, f form.UpdateProfile) {
|
||||
uploadedURL, err := storage.UploadAvatarToS3(avatarFile, avatarFileHeader)
|
||||
if err != nil {
|
||||
if errors.Is(err, imagecheck.ErrImageTooLarge) {
|
||||
ctx.SetErrorFlash(err.Error())
|
||||
ctx.SetError(err, f)
|
||||
ctx.Success("user/profile")
|
||||
return
|
||||
}
|
||||
if errors.Is(err, imagecheck.ErrBadAspectRatio) {
|
||||
ctx.SetErrorFlash(i18n.T(ctx.Lang(), "profile.err.avatarRatio"))
|
||||
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "profile.err.avatarRatio")), f)
|
||||
ctx.Success("user/profile")
|
||||
return
|
||||
}
|
||||
@@ -122,12 +122,12 @@ func UpdateProfile(ctx context.Context, f form.UpdateProfile) {
|
||||
uploadedURL, err := storage.UploadBackgroundToS3(backgroundFile, backgroundFileHeader)
|
||||
if err != nil {
|
||||
if errors.Is(err, imagecheck.ErrImageTooLarge) {
|
||||
ctx.SetErrorFlash(err.Error())
|
||||
ctx.SetError(err, f)
|
||||
ctx.Success("user/profile")
|
||||
return
|
||||
}
|
||||
if errors.Is(err, imagecheck.ErrBadAspectRatio) {
|
||||
ctx.SetErrorFlash(i18n.T(ctx.Lang(), "profile.err.backgroundRatio"))
|
||||
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "profile.err.backgroundRatio")), f)
|
||||
ctx.Success("user/profile")
|
||||
return
|
||||
}
|
||||
@@ -150,7 +150,7 @@ func UpdateProfile(ctx context.Context, f form.UpdateProfile) {
|
||||
uploadedURL, err := storage.UploadPictureToS3(backgroundimageFile, backgroundimageFileHeader)
|
||||
if err != nil {
|
||||
if errors.Is(err, imagecheck.ErrImageTooLarge) {
|
||||
ctx.SetErrorFlash(err.Error())
|
||||
ctx.SetError(err, f)
|
||||
ctx.Success("user/profile")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user