Register ID fix

This commit is contained in:
2025-02-07 11:33:59 +08:00
parent 895837b52b
commit 0bc2c208f9

View File

@@ -1,4 +1,5 @@
using AceJobAgency.Data;
using System.Diagnostics;
using AceJobAgency.Data;
using AceJobAgency.Entities;
using Microsoft.AspNetCore.Mvc;
@@ -17,14 +18,15 @@ namespace AceJobAgency.Controllers
return BadRequest("User with the same email already exists.");
}
string passwordHash = BCrypt.Net.BCrypt.HashPassword(user.Password);
var passwordHash = BCrypt.Net.BCrypt.HashPassword(user.Password);
user.Password = passwordHash;
user.Id = Guid.NewGuid().ToString();
var userId = Guid.NewGuid().ToString();
user.Id = userId;
await context.Users.AddAsync(user);
await context.SaveChangesAsync();
return Ok();
return Ok(user);
}
}
}