This should do it

This commit is contained in:
Azareal 2018-06-17 18:12:39 +10:00
parent 97cd88d02b
commit 1308027c34
2 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,6 @@ import (
"time" "time"
"./common" "./common"
"./config"
"./install/install" "./install/install"
"./query_gen/lib" "./query_gen/lib"
"./routes" "./routes"
@ -53,10 +52,15 @@ func gloinit() (err error) {
//nogrouplog = true //nogrouplog = true
common.StartTime = time.Now() common.StartTime = time.Now()
err = common.LoadConfig()
if err != nil {
return err
}
err = common.ProcessConfig() err = common.ProcessConfig()
if err != nil { if err != nil {
return err return err
} }
common.Themes, err = common.NewThemeList() common.Themes, err = common.NewThemeList()
if err != nil { if err != nil {
return err return err
@ -92,7 +96,6 @@ func gloinit() (err error) {
} }
func init() { func init() {
config.Config()
err := gloinit() err := gloinit()
if err != nil { if err != nil {
log.Print("Something bad happened") log.Print("Something bad happened")

View File

@ -883,18 +883,18 @@ func TestAuth(t *testing.T) {
passwordTest(t, realPassword, hashedPassword2) passwordTest(t, realPassword, hashedPassword2)
// TODO: Peek at the prefix to verify this is a bcrypt hash // TODO: Peek at the prefix to verify this is a bcrypt hash
_, err = common.Auth.Authenticate("None", "password") _, err, _ = common.Auth.Authenticate("None", "password")
errmsg := "Username None shouldn't exist" errmsg := "Username None shouldn't exist"
if err != nil { if err != nil {
errmsg += "\n" + err.Error() errmsg += "\n" + err.Error()
} }
expect(t, err == common.ErrNoUserByName, errmsg) expect(t, err == common.ErrNoUserByName, errmsg)
uid, err := common.Auth.Authenticate("Admin", "password") uid, err, _ := common.Auth.Authenticate("Admin", "password")
expectNilErr(t, err) expectNilErr(t, err)
expect(t, uid == 1, fmt.Sprintf("Default admin uid should be 1 not %d", uid)) expect(t, uid == 1, fmt.Sprintf("Default admin uid should be 1 not %d", uid))
_, err = common.Auth.Authenticate("Sam", "ReallyBadPassword") _, err, _ = common.Auth.Authenticate("Sam", "ReallyBadPassword")
errmsg = "Username Sam shouldn't exist" errmsg = "Username Sam shouldn't exist"
if err != nil { if err != nil {
errmsg += "\n" + err.Error() errmsg += "\n" + err.Error()