mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Check if keys exist in map. Fixes: #736
This commit is contained in:
parent
ce78299464
commit
473aaf13be
@ -89,25 +89,24 @@ func getAuthentication(flags *pflag.FlagSet, defaults ...interface{}) (settings.
|
|||||||
secret := mustGetString(flags, "recaptcha.secret")
|
secret := mustGetString(flags, "recaptcha.secret")
|
||||||
|
|
||||||
if key == "" {
|
if key == "" {
|
||||||
kmap := defaultAuther["recaptcha"].(map[string]interface{})
|
if kmap, ok := defaultAuther["recaptcha"].(map[string]interface{}); ok {
|
||||||
key = kmap["key"].(string)
|
key = kmap["key"].(string)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if secret == "" {
|
if secret == "" {
|
||||||
smap := defaultAuther["recaptcha"].(map[string]interface{})
|
if smap, ok := defaultAuther["recaptcha"].(map[string]interface{}); ok {
|
||||||
secret = smap["secret"].(string)
|
secret = smap["secret"].(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
if key == "" || secret == "" {
|
|
||||||
checkErr(nerrors.New("you must set the flag 'recaptcha.key' and 'recaptcha.secret' for method 'json'"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if key != "" && secret != "" {
|
||||||
jsonAuth.ReCaptcha = &auth.ReCaptcha{
|
jsonAuth.ReCaptcha = &auth.ReCaptcha{
|
||||||
Host: host,
|
Host: host,
|
||||||
Key: key,
|
Key: key,
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
auther = jsonAuth
|
auther = jsonAuth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user