working sections version

This commit is contained in:
ston1th 2019-03-27 23:08:59 +01:00
commit 9424084a36
28 changed files with 367 additions and 251 deletions

View file

@ -4,7 +4,6 @@ package db
import (
"crypto/sha256"
"git.giftfish.de/ston1th/gowiki/pkg/core"
"time"
)
@ -14,10 +13,11 @@ var reservedNames = []string{
"logout",
"new",
"search",
"section",
"sections",
"user",
"users",
"view",
"wiki",
}
// Parts taken from strings.TrimPrefix
@ -28,20 +28,6 @@ func hasTrimPrefix(s, prefix string) (string, bool) {
return s, false
}
func addOrRemove(s string, a []string) []string {
i, _ := core.Contains(s, a)
switch i {
case -1:
return append(a, s)
case 0:
return a[1:]
case len(a):
return a[:i]
default:
return append(a[:i], a[i+1:]...)
}
}
func validatePassword(pw string) (b []byte) {
b = []byte(pw)
if len(pw) <= 56 {