mirror of
https://github.com/foomo/gofoomo.git
synced 2025-10-16 12:25:44 +00:00
using passed in basic auth to avoid conficts, if given
This commit is contained in:
parent
929ed74872
commit
7ccda9d1be
@ -79,6 +79,14 @@ func makeFoomo(foomoDir string, runMode string, address string, init bool) (f *F
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *Foomo) setupBasicAuthCredentials() error {
|
func (f *Foomo) setupBasicAuthCredentials() error {
|
||||||
|
if f.URL.User != nil {
|
||||||
|
f.basicAuthCredentials.user = f.URL.User.Username()
|
||||||
|
password, passwordOK := f.URL.User.Password()
|
||||||
|
if passwordOK {
|
||||||
|
f.basicAuthCredentials.password = password
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
f.basicAuthCredentials.user = "gofoomo"
|
f.basicAuthCredentials.user = "gofoomo"
|
||||||
f.basicAuthCredentials.password = makeToken(50)
|
f.basicAuthCredentials.password = makeToken(50)
|
||||||
return htpasswd.SetPassword(f.GetBasicAuthFilename("default"), f.basicAuthCredentials.user, f.basicAuthCredentials.password, htpasswd.HashBCrypt)
|
return htpasswd.SetPassword(f.GetBasicAuthFilename("default"), f.basicAuthCredentials.user, f.basicAuthCredentials.password, htpasswd.HashBCrypt)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user