referencing issue #81

This commit is contained in:
George Shaw 2017-12-07 15:59:45 -06:00
parent 7c35770f26
commit cd3c4eee96
2 changed files with 14 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import (
"strconv"
"github.com/Ennovar/gPanel/pkg/routing"
"strings"
)
// ServeHTTP function routes all requests for the private webhost server. It is used in the main
@ -19,6 +20,12 @@ func (con *Controller) ServeHTTP(res http.ResponseWriter, req *http.Request) {
path = (con.DocumentRoot + path)
}
if strings.HasSuffix(path, "index.html") {
if con.checkAuth(res, req) == true {
http.Redirect(res, req, "gPanel.html", http.StatusFound)
}
}
if reqAuth(path) {
if !con.checkAuth(res, req) {
con.AccountLogger.Println(path + "::" + strconv.Itoa(http.StatusUnauthorized) + "::" + http.StatusText(http.StatusUnauthorized))

View file

@ -7,6 +7,7 @@ import (
"strconv"
"github.com/Ennovar/gPanel/pkg/routing"
"strings"
)
func (con *Controller) ServeHTTP(res http.ResponseWriter, req *http.Request) {
@ -17,6 +18,12 @@ func (con *Controller) ServeHTTP(res http.ResponseWriter, req *http.Request) {
path = (con.Directory + con.DocumentRoot + path)
}
if strings.HasSuffix(path, "index.html") {
if con.checkAuth(res, req) == true {
http.Redirect(res, req, "gPanel.html", http.StatusFound)
}
}
if reqAuth(path) {
if !con.checkAuth(res, req) {
con.ServerLogger.Println(path + "::" + strconv.Itoa(http.StatusUnauthorized) + "::" + http.StatusText(http.StatusUnauthorized))