Update uploadHandler.go
Cette révision appartient à :
Parent
2f2d03667c
révision
bc3de070af
1 fichiers modifiés avec 8 ajouts et 2 suppressions
|
@ -16,14 +16,20 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if config.UploadsDisabled {
|
user := GetUser(r)
|
||||||
|
if config.UploadsDisabled && config.AdminsAreStillAllowedTo && user.Status != 2 && config.TrustedUsersAreStillAllowedTo && user.Status != 1 {
|
||||||
|
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
} else if config.UploadsDisabled && !config.AdminsAreStillAllowedTo && user.Status == 2 {
|
||||||
|
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
} else if config.UploadsDisabled && !config.TrustedUsersAreStillAllowedTo && user.Status == 1 {
|
||||||
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
|
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var uploadForm UploadForm
|
var uploadForm UploadForm
|
||||||
if r.Method == "POST" {
|
if r.Method == "POST" {
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
user := GetUser(r)
|
|
||||||
if userPermission.NeedsCaptcha(user) {
|
if userPermission.NeedsCaptcha(user) {
|
||||||
userCaptcha := captcha.Extract(r)
|
userCaptcha := captcha.Extract(r)
|
||||||
if !captcha.Authenticate(userCaptcha) {
|
if !captcha.Authenticate(userCaptcha) {
|
||||||
|
|
Référencer dans un nouveau ticket