mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-06 10:00:26 +00:00
Fix auth system not getting enabled
This commit is contained in:
parent
3d911fc51b
commit
989ed43455
2
flag.go
2
flag.go
@ -8,7 +8,6 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/assets"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
@ -55,5 +54,4 @@ func parseCliArgs() {
|
||||
util.HomePage = util.CanonicalName(util.HomePage)
|
||||
util.UserHypha = util.CanonicalName(util.UserHypha)
|
||||
util.HeaderLinksHypha = util.CanonicalName(util.HeaderLinksHypha)
|
||||
user.AuthUsed = util.UseFixedAuth || util.UseRegistration
|
||||
}
|
||||
|
8
main.go
8
main.go
@ -6,7 +6,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
@ -15,6 +14,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/assets"
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/shroom"
|
||||
@ -193,9 +193,9 @@ func main() {
|
||||
hyphae.Index(WikiDir)
|
||||
log.Println("Indexed", hyphae.Count(), "hyphae")
|
||||
|
||||
if user.AuthUsed && (util.FixedCredentialsPath != "" || util.RegistrationCredentialsPath != "") {
|
||||
user.ReadUsersFromFilesystem()
|
||||
}
|
||||
// Initialize user database
|
||||
user.InitUserDatabase()
|
||||
|
||||
history.Start(WikiDir)
|
||||
shroom.SetHeaderLinks()
|
||||
|
||||
|
@ -2,14 +2,25 @@ package user
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
// ReadUsersFromFilesystem reads all user information from filesystem and stores it internally. Call it during initialization.
|
||||
// InitUserDatabase checks the configuration for auth methods and loads users
|
||||
// if necessary. Call it during initialization.
|
||||
func InitUserDatabase() {
|
||||
AuthUsed = util.UseFixedAuth || util.UseRegistration
|
||||
|
||||
if AuthUsed && (util.FixedCredentialsPath != "" || util.RegistrationCredentialsPath != "") {
|
||||
ReadUsersFromFilesystem()
|
||||
}
|
||||
}
|
||||
|
||||
// ReadUsersFromFilesystem reads all user information from filesystem and stores it internally.
|
||||
func ReadUsersFromFilesystem() {
|
||||
if util.UseFixedAuth {
|
||||
rememberUsers(usersFromFixedCredentials())
|
||||
|
Loading…
Reference in New Issue
Block a user