aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/oauth2_callback.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-06-01 18:18:09 -0700
committerGravatar fguillot <fred@miniflux.net>2019-06-02 06:30:08 -0700
commit228862fefaa645026caa483ffe9993bf8c00b22e (patch)
tree2b590dc6cda3e50928a31ce673641357805f75ce /ui/oauth2_callback.go
parent04d85b3c63afcf6c9539fc8dc7a91c4e36c2e8fb (diff)
Refactor config package
- Parse configuration only once during startup time - Store configuration values in a global variable
Diffstat (limited to 'ui/oauth2_callback.go')
-rw-r--r--ui/oauth2_callback.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui/oauth2_callback.go b/ui/oauth2_callback.go
index bd7c999..6dce3d9 100644
--- a/ui/oauth2_callback.go
+++ b/ui/oauth2_callback.go
@@ -7,6 +7,7 @@ package ui // import "miniflux.app/ui"
import (
"net/http"
+ "miniflux.app/config"
"miniflux.app/http/cookie"
"miniflux.app/http/request"
"miniflux.app/http/response/html"
@@ -43,7 +44,7 @@ func (h *handler) oauth2Callback(w http.ResponseWriter, r *http.Request) {
return
}
- authProvider, err := getOAuth2Manager(h.cfg).Provider(provider)
+ authProvider, err := getOAuth2Manager().Provider(provider)
if err != nil {
logger.Error("[OAuth2] %v", err)
html.Redirect(w, r, route.Path(h.router, "login"))
@@ -90,7 +91,7 @@ func (h *handler) oauth2Callback(w http.ResponseWriter, r *http.Request) {
}
if user == nil {
- if !h.cfg.IsOAuth2UserCreationAllowed() {
+ if !config.Opts.IsOAuth2UserCreationAllowed() {
html.Forbidden(w, r)
return
}
@@ -121,8 +122,8 @@ func (h *handler) oauth2Callback(w http.ResponseWriter, r *http.Request) {
http.SetCookie(w, cookie.New(
cookie.CookieUserSessionID,
sessionToken,
- h.cfg.IsHTTPS,
- h.cfg.BasePath(),
+ config.Opts.HTTPS,
+ config.Opts.BasePath(),
))
html.Redirect(w, r, route.Path(h.router, "unread"))