mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-01 09:52:23 -06:00
Merge pull request #886 from owncloud/show-basic-auth-warning-on-startup-only
Show basic_auth warning only on startup
This commit is contained in:
6
changelog/unreleased/dont-nag-about-basicauth.md
Normal file
6
changelog/unreleased/dont-nag-about-basicauth.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Enhancement: Show basic-auth warning only once
|
||||
|
||||
Show basic-auth warning only on startup instead on every request.
|
||||
|
||||
|
||||
https://github.com/owncloud/ocis/pull/886
|
||||
@@ -15,6 +15,9 @@ const publicFilesEndpoint = "/remote.php/dav/public-files/"
|
||||
// BasicAuth provides a middleware to check if BasicAuth is provided
|
||||
func BasicAuth(optionSetters ...Option) func(next http.Handler) http.Handler {
|
||||
options := newOptions(optionSetters...)
|
||||
if options.EnableBasicAuth {
|
||||
options.Logger.Warn().Msg("basic auth enabled, use only for testing or development")
|
||||
}
|
||||
|
||||
return func(next http.Handler) http.Handler {
|
||||
return &basicAuth{
|
||||
@@ -41,8 +44,6 @@ func (m basicAuth) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
m.logger.Warn().Msg("basic auth enabled, use only for testing or development")
|
||||
|
||||
login, password, _ := req.BasicAuth()
|
||||
|
||||
account, status := getAccount(m.logger, m.accountsClient, fmt.Sprintf("login eq '%s' and password eq '%s'", strings.ReplaceAll(login, "'", "''"), strings.ReplaceAll(password, "'", "''")))
|
||||
|
||||
Reference in New Issue
Block a user