Creating new admin user from CLI
go run ./cmd/migrate new admin
This commit is contained in:
@@ -32,10 +32,11 @@ type User struct {
|
||||
}
|
||||
|
||||
func (u *User) Insert(db *bun.DB, ctx context.Context) (sql.Result, error) {
|
||||
u.Password = fmt.Sprintf("crypt('%s', gen_salt('bf'))", u.Password)
|
||||
return db.NewInsert().
|
||||
Model(u).
|
||||
Value("password", u.Password).
|
||||
Value("password", "crypt(?, gen_salt('bf'))", u.Password).
|
||||
Ignore().
|
||||
// Returning("user_id").
|
||||
Exec(ctx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user