fix auth setup bug
This commit is contained in:
@@ -129,7 +129,7 @@ func (q *QBit) ProcessFiles(torrent *Torrent, debridTorrent *debrid.Torrent, arr
|
|||||||
torrentFolderNoExt := utils.RemoveExtension(debridTorrent.Name)
|
torrentFolderNoExt := utils.RemoveExtension(debridTorrent.Name)
|
||||||
|
|
||||||
torrentSymlinkPath, err = q.createSymlinksWebdav(debridTorrent, rclonePath, torrentFolderNoExt) // /mnt/symlinks/{category}/MyTVShow/
|
torrentSymlinkPath, err = q.createSymlinksWebdav(debridTorrent, rclonePath, torrentFolderNoExt) // /mnt/symlinks/{category}/MyTVShow/
|
||||||
q.logger.Debug().Msgf("Process Completed in %s", time.Since(timer))
|
q.logger.Debug().Msgf("Torrent adding process completed in %s", time.Since(timer))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// User is using either zurg or debrid webdav
|
// User is using either zurg or debrid webdav
|
||||||
|
|||||||
@@ -102,13 +102,13 @@ func (ui *Handler) authMiddleware(next http.Handler) http.Handler {
|
|||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Check if setup is needed
|
// Check if setup is needed
|
||||||
cfg := config.Get()
|
cfg := config.Get()
|
||||||
if cfg.NeedsAuth() && r.URL.Path != "/auth" {
|
if !cfg.UseAuth {
|
||||||
http.Redirect(w, r, "/auth", http.StatusSeeOther)
|
next.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.UseAuth {
|
if cfg.NeedsAuth() && r.URL.Path != "/auth" {
|
||||||
next.ServeHTTP(w, r)
|
http.Redirect(w, r, "/auth", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +147,11 @@ func (ui *Handler) verifyAuth(username, password string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ui *Handler) LoginHandler(w http.ResponseWriter, r *http.Request) {
|
func (ui *Handler) LoginHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
cfg := config.Get()
|
||||||
|
if cfg.NeedsAuth() {
|
||||||
|
http.Redirect(w, r, "/auth", http.StatusSeeOther)
|
||||||
|
return
|
||||||
|
}
|
||||||
if r.Method == "GET" {
|
if r.Method == "GET" {
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"Page": "login",
|
"Page": "login",
|
||||||
@@ -196,7 +201,7 @@ func (ui *Handler) SetupHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
cfg := config.Get()
|
cfg := config.Get()
|
||||||
authCfg := cfg.GetAuth()
|
authCfg := cfg.GetAuth()
|
||||||
|
|
||||||
if !cfg.NeedsSetup() {
|
if !cfg.NeedsAuth() {
|
||||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user