user dtos as strict object templates
This commit is contained in:
@@ -22,9 +22,9 @@ public class AuthController : ControllerBase {
|
||||
public async Task<ActionResult> Register(RegisterDto dto) {
|
||||
var user = new User {
|
||||
Name = dto.Username,
|
||||
Email = "dummy@goofy.xyz",
|
||||
Email = dto.Email,
|
||||
PasswordHash = BCrypt.Net.BCrypt.HashPassword(dto.Password), // TODO: secondary hashing stage in client
|
||||
Role = "admin (FOR NOW !!)",
|
||||
Role = "user",
|
||||
CreatedAt = DateTime.UtcNow // yeah why not utc
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
public class RegisterDto {
|
||||
|
||||
public string Username { get; set; } = "";
|
||||
public string Email { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
}
|
||||
|
||||
public class LoginDto {
|
||||
|
||||
public string Username { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ public class User {
|
||||
public string Name { get; set; } = "";
|
||||
public string Email { get; set; } = "";
|
||||
public string PasswordHash { get; set; } = "";
|
||||
public string Role { get; set; }
|
||||
public string Role { get; set; } = "";
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user