diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-09-25 15:35:54 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-09-25 15:35:54 +0200 |
commit | c06f52837e5b4aab5335e5a66885c48c24a148a2 (patch) | |
tree | d519f4e53c08e9de2fc3c30606031960c53429fe /picture.go | |
parent | d0ed765be72f80034fa530ba037e488c35abdd9e (diff) | |
download | guichet-c06f52837e5b4aab5335e5a66885c48c24a148a2.tar.gz guichet-c06f52837e5b4aab5335e5a66885c48c24a148a2.zip |
WIP refactor (broken templates)
Diffstat (limited to 'picture.go')
-rw-r--r-- | picture.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -44,7 +44,7 @@ func newMinioClient() (*minio.Client, error) { } // Upload image through guichet server. -func uploadProfilePicture(w http.ResponseWriter, r *http.Request, login *LoginStatus) (string, error) { +func uploadProfilePicture(w http.ResponseWriter, r *http.Request, user *LoggedUser) (string, error) { file, _, err := r.FormFile("image") if err == http.ErrMissingFile { @@ -74,7 +74,7 @@ func uploadProfilePicture(w http.ResponseWriter, r *http.Request, login *LoginSt // If a previous profile picture existed, delete it // (don't care about errors) - if nameConsul := login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE); nameConsul != "" { + if nameConsul := user.Entry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE); nameConsul != "" { mc.RemoveObject(context.Background(), config.S3Bucket, nameConsul, minio.RemoveObjectOptions{}) mc.RemoveObject(context.Background(), config.S3Bucket, nameConsul+"-thumb", minio.RemoveObjectOptions{}) } @@ -144,9 +144,9 @@ func resizePicture(file multipart.File, buffFull, buffThumb *bytes.Buffer) error func handleDownloadPicture(w http.ResponseWriter, r *http.Request) { name := mux.Vars(r)["name"] - //Check login - login := checkLogin(w, r) - if login == nil { + // Get user + user := RequireUserHtml(w, r) + if user == nil { return } |