OTP support

This commit is contained in:
Xavier Henner
2019-08-18 16:29:37 +02:00
parent 07b37e9bc4
commit e9f6a04864
7 changed files with 118 additions and 32 deletions

View File

@@ -22,6 +22,7 @@ type jsonInputParams struct {
Session int `json:"session"`
User string `json:"user"`
Pass string `json:"password"`
OTP string `json:"otp"`
}
type HttpServer struct {
@@ -84,7 +85,7 @@ func (h *HttpServer) ajaxHandler(w http.ResponseWriter, r *http.Request) {
err = h.ovpn.SetRemote(req.Params.Server, req.Params.Session)
jsonStr = []byte("{\"status\": \"ok\"}")
case "auth-user-pass":
err = h.ovpn.AuthUserPass(req.Params.Session, req.Params.User, req.Params.Pass)
err = h.ovpn.AuthUserPass(req.Params.Session, req.Params.User, req.Params.Pass, req.Params.OTP)
jsonStr = []byte("{\"status\": \"ok\"}")
case "get-sessions":
jsonStr, err = json.Marshal(h.ovpn)