diff --git a/dbi/user.go b/dbi/user.go index 8408747..78a226d 100644 --- a/dbi/user.go +++ b/dbi/user.go @@ -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 (?, ?, ?, ?, ?, ?)`,