commit - e2ab3f7c357e4a40a2891afece9f3ee0adb66008
commit + a039d5d3dec690069733d885665406a79171b141
blob - c11252d89e1561853f49e9cbabd54d25986d8328
blob + f28b7795983870c419864372f6de45993ff977b0
--- userdb.go
+++ userdb.go
}
// OpenUserDB opens the named user database file and ticket directory.
-// If the database does not exist, it is created and its tables are
+// If the database does not exist, it is created and its tables are
// initialised ready for use.
func OpenUserDB(name, dir string) (*UserDB, error) {
db, err := sql.Open("sqlite3", name)
func (db *UserDB) add(username string, pw Password) error {
if len(username) > maxUsernameLength {
- return fmt.Errorf("add %s: invalid username: too long", username)
+ return fmt.Errorf("add %s: bad username: too long", username)
}
addr, err := mail.ParseAddress(username)
if err != nil {
- return fmt.Errorf("add %s: invalid username: %w", username, err)
+ return fmt.Errorf("add %s: bad username: %w", username, err)
}
if addr.Name != "" {
- return fmt.Errorf("add %s: proper name present", username)
+ return fmt.Errorf("add %s: bad username: proper name present", username)
}
hashed, err := bcrypt.GenerateFromPassword(pw, bcrypt.DefaultCost)