unstable: initial tags

This commit is contained in:
ston1th 2019-08-20 23:57:43 +02:00
commit b3b62af3a4
28 changed files with 503 additions and 91 deletions

View file

@ -7,7 +7,6 @@ import (
"git.giftfish.de/ston1th/docstore/pkg/core"
"git.giftfish.de/ston1th/docstore/pkg/otp"
"golang.org/x/crypto/bcrypt"
"regexp"
"strings"
)
@ -20,8 +19,6 @@ var (
errWrongLogin = errors.New("db: wrong login")
errLocked = errors.New("db: user locked")
errUserExists = errors.New("db: user already exist")
userRe = regexp.MustCompile("[^a-zA-Z0-9]+")
)
func (db *DB) UserExists() (b bool) {
@ -53,7 +50,7 @@ func (db *DB) GetUser() (u core.User, err error) {
}
func (db *DB) CreateUser(username, password string) error {
username = userRe.ReplaceAllString(username, "")
username = nameRe.ReplaceAllString(username, "")
if db.UserExists() {
return errUserExists
}