Simplify: register not return user object

This commit is contained in:
2021-12-13 13:47:02 +08:00
parent d7ca68aad1
commit adee9bcb65
2 changed files with 7 additions and 15 deletions

View File

@@ -22,10 +22,10 @@ func (database *Database) LoginAsAnonymous() (*User, error) {
return user, nil
}
func (database *Database) Register(username string, password string, usertype int64) (*User, error) {
func (database *Database) Register(username string, password string, usertype int64) (error) {
countAdmin, err := database.CountAdmin()
if err != nil {
return nil, err
return err
}
active := false
@@ -40,9 +40,9 @@ func (database *Database) Register(username string, password string, usertype in
_, err = database.stmt.insertUser.Exec(username, password, usertype, active, 0)
if err != nil {
return nil, err
return err
}
return database.Login(username, password)
return nil
}
func (database *Database) GetUserById(id int64) (*User, error) {