From 98fb6942fe62a46aecf310cc935b6e9f94594eb9 Mon Sep 17 00:00:00 2001 From: Jean Jacques Avril Date: Fri, 3 Jan 2025 19:22:03 +0000 Subject: [PATCH] applied secure passwords --- .../internal/infrastructure/data/prisma_user_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend-go/internal/infrastructure/data/prisma_user_data_source.go b/backend-go/internal/infrastructure/data/prisma_user_data_source.go index a4fad0d..f6c4d5a 100644 --- a/backend-go/internal/infrastructure/data/prisma_user_data_source.go +++ b/backend-go/internal/infrastructure/data/prisma_user_data_source.go @@ -4,6 +4,7 @@ import ( "actatempus_backend/internal/domain/app_error" "actatempus_backend/internal/domain/entities" "actatempus_backend/internal/infrastructure/data/db" + "actatempus_backend/internal/utils" "context" "fmt" @@ -25,7 +26,7 @@ func (ds *PrismaUserDataSource) Create(ctx context.Context, user entities.UserCr createdUser, err := ds.client.UserDbo.CreateOne( db.UserDbo.Name.Set(user.Name), db.UserDbo.Email.Set(user.Email), - db.UserDbo.Password.Set(user.Password), + db.UserDbo.Password.Set(GenerateSecureHash(user.Password)), ).Exec(ctx) if err != nil { @@ -82,7 +83,7 @@ func (ds *PrismaUserDataSource) Update(ctx context.Context, user entities.UserUp ).Update( db.UserDbo.Name.SetIfPresent(user.Name), db.UserDbo.Email.SetIfPresent(user.Email), - db.UserDbo.Password.SetIfPresent(user.Password), + db.UserDbo.Password.SetIfPresent(utils.Let(user.Password, GenerateSecureHash)), ).Exec(ctx) if err != nil {