diff --git a/agent/agent.go b/agent/agent.go index 8c5ee3157..08e3175ee 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -17,7 +17,7 @@ func generateAgent(ctx *api.Context, body api.GenerateAgentRequest) (*api.Genera return nil, fmt.Errorf("failed to generate username and password: %w", err) } - person, err := db.CreatePerson(ctx, username, "agent") + person, err := db.CreatePerson(ctx, username, fmt.Sprintf("%s@local", username), "agent") if err != nil { return nil, fmt.Errorf("failed to create a new person: %w", err) } diff --git a/db/people.go b/db/people.go index cf601341c..83138457c 100644 --- a/db/people.go +++ b/db/people.go @@ -49,8 +49,8 @@ type CreateUserRequest struct { Properties models.PersonProperties } -func CreatePerson(ctx *api.Context, name, personType string) (*models.Person, error) { - person := models.Person{Name: name, Type: personType} +func CreatePerson(ctx *api.Context, name, email, personType string) (*models.Person, error) { + person := models.Person{Name: name, Email: email, Type: personType} if err := ctx.DB().Clauses(clause.Returning{}).Create(&person).Error; err != nil { return nil, err }