if test are hard :)

This commit is contained in:
Xavier Henner
2019-07-18 12:33:10 +02:00
parent e18aa583d0
commit 2c289f8125
2 changed files with 23 additions and 10 deletions

View File

@@ -120,8 +120,8 @@ func (h *HttpServer) ajaxHandler(w http.ResponseWriter, r *http.Request) {
webuser := strings.Replace(r.TLS.PeerCertificates[0].Subject.CommonName, " ", "", -1)
_, _, _, profilePath := h.ovpn.AuthLoop(h.minProfile, webuser, "", false)
if inArray(h.neededProfiles, profilePath) {
http.Error(w, fmt.Sprintf("You need on of %s profile", h.neededProfiles), 403)
if !inArray(h.neededProfiles, profilePath) {
http.Error(w, fmt.Sprintf("You need on of %s profile and you have %s", h.neededProfiles, profilePath), 403)
return
}
log.Printf("%s is connected via the web interfaces\n", webuser)