// Copyright (C) 2020 Marius Schellenberger package db import ( "crypto/sha256" "git.giftfish.de/ston1th/gowiki/pkg/core" "time" ) func init() { reservedNames = make([]string, len(reservedURIs)) for i, v := range reservedURIs { reservedNames[i] = v[1:] } } var reservedURIs = []string{ core.LoginURI, core.LogoutURI, core.TotpURI, core.SectionsURI, core.SectionURI, core.SearchURI, core.StatsURI, core.NewURI, core.BlacklistURI, core.UsersURI, core.UserURI, core.ViewURI, } var reservedNames []string func validatePassword(pw string) (b []byte) { b = []byte(pw) if len(pw) <= 56 { return } hash := sha256.New() hash.Write(b) b = hash.Sum(nil) return } const timeFmt = "2006-01-02 15:04:05" func now() string { return time.Now().Format(timeFmt) } func created(username string) string { return username + " " + now() }