forked from tildetown/town
set created and admin when inserting user
parent
e12d92735d
commit
1bec2349cb
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"git.tilde.town/tildetown/town/invites"
|
||||
"git.tilde.town/tildetown/town/stats"
|
||||
|
@ -182,6 +183,7 @@ func createUser(data newUserData) (err error) {
|
|||
|
||||
tu := towndb.TownUser{
|
||||
Username: data.Username,
|
||||
Created: time.Now(),
|
||||
Emails: []string{
|
||||
data.Email,
|
||||
},
|
||||
|
|
|
@ -83,14 +83,9 @@ func (u *TownUser) Insert(db *sql.DB) (err error) {
|
|||
}
|
||||
}()
|
||||
|
||||
// TODO this does not set the admin flag intentionally as rn this code is
|
||||
// just meant to be called by the welcome binary; other stuff for now is just
|
||||
// expected to be done via sql
|
||||
|
||||
u.Created = time.Now()
|
||||
if stmt, err = tx.Prepare(`
|
||||
INSERT INTO users (created, username, state)
|
||||
VALUES (?, ?, ?)`); err != nil {
|
||||
INSERT INTO users (created, username, state, admin)
|
||||
VALUES (?, ?, ?, ?)`); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue