Fix retrieving over openid providers if there are none

Fixes #767
This commit is contained in:
kolaente 2021-01-15 20:40:07 +01:00
parent 32c021e2b3
commit 20af034d78
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -31,6 +31,10 @@ import (
// GetAllProviders returns all configured providers
func GetAllProviders() (providers []*Provider, err error) {
if !config.AuthOpenIDEnabled.GetBool() {
return nil, nil
}
ps, err := keyvalue.Get("openid_providers")
if err != nil && kerr.IsErrValueNotFoundForKey(err) {
rawProviders := config.AuthOpenIDProviders.Get()
@ -92,7 +96,12 @@ func getKeyFromName(name string) string {
}
func getProviderFromMap(pi map[interface{}]interface{}) (*Provider, error) {
k := getKeyFromName(pi["name"].(string))
name, is := pi["name"].(string)
if !is {
return nil, nil
}
k := getKeyFromName(name)
provider := &Provider{
Name: pi["name"].(string),