blank state

This commit is contained in:
2019-07-21 19:23:13 +02:00
parent 2c289f8125
commit 0e72c3a242
48 changed files with 14 additions and 5874 deletions

View File

@@ -119,11 +119,9 @@ 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 and you have %s", h.neededProfiles, profilePath), 403)
return
}
//TODO security
log.Printf("%s is connected via the web interfaces\n", webuser)
req, err := parseJsonQuery(r)
@@ -135,17 +133,7 @@ func (h *HttpServer) ajaxHandler(w http.ResponseWriter, r *http.Request) {
switch req.Action {
case "stats":
jsonStr, err := json.Marshal(h.ovpn.Stats())
if err != nil {
http.Error(w, fmt.Sprintf("%s", err), 500)
}
fmt.Fprintf(w, "%s", jsonStr)
case "kill":
if err := h.ovpn.Kill(req.Params.Session, req.Params.Id, webuser); err != nil {
http.Error(w, fmt.Sprintf("%s", err), 500)
}
fmt.Fprintf(w, "{}")
default:
http.Error(w, "Invalid request", 500)
}