mirror of
https://github.com/donl/gPanel.git
synced 2026-06-30 06:12:06 -06:00
referencing issue #81
This commit is contained in:
parent
7c35770f26
commit
cd3c4eee96
2 changed files with 14 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue