@ -2,6 +2,7 @@ package dbi
import (
"context"
"crypto/md5"
"database/sql"
"fmt"
)
@ -19,6 +20,9 @@ func CreateUser(conn *sql.Conn, user *User) error {
if user.APIKey == "" {
user.APIKey = GenUUID()
}
if user.Password != "" {
user.Password := md5.Sum([]byte(user.Password))
_, err := conn.ExecContext(context.Background(),
`INSERT INTO users (APIKey, FirstName, LastName, Password, Status, Username)
VALUES (?, ?, ?, ?, ?, ?)`,