mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: totp 2fa; httpcontext extension for jwtuser; asp.net data protection; prevent banned users from certain actions; account deletion requires 2fa if enabled; making users admins requires 2fa if enabled; httpcontext extension to get ip; enhance user store
refactor: organize dtos by domain; verification providers use verification context; move ip parsing into http context extensions chore: clean code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
namespace SharpbinV3.Server.DTOs.Auth
|
||||
{
|
||||
public class JWTResult
|
||||
public class CreateJWT
|
||||
{
|
||||
public string? Token { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace SharpbinV3.Server.DTOs.Auth
|
||||
{
|
||||
public class DisableTotpDto
|
||||
{
|
||||
public string Code { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace SharpbinV3.Server.DTOs.Auth
|
||||
{
|
||||
public sealed class EnableTotpDto
|
||||
{
|
||||
public string Secret { get; set; } = string.Empty;
|
||||
public string Code { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
namespace SharpbinV3.Server.DTOs.Auth
|
||||
{
|
||||
public class RefreshTokenRequest
|
||||
public class RefreshTokenDto
|
||||
{
|
||||
[Required]
|
||||
public required string Token { get; set; }
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
namespace SharpbinV3.Server.DTOs.Auth
|
||||
{
|
||||
public class TurnstileResponse
|
||||
public class TurnstileResponseDto
|
||||
{
|
||||
[JsonPropertyName("success")]
|
||||
public bool Success { get; set; }
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
namespace SharpbinV3.Server.DTOs.Paste
|
||||
{
|
||||
public class PasteMetadataUpdateRequest
|
||||
public class UpdatePasteDto
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
public string? Syntax { get; set; }
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace SharpbinV3.Server.DTOs.User
|
||||
{
|
||||
public class DeleteUserDto
|
||||
{
|
||||
public string? Token { get; set; }
|
||||
public string? TotpCode { get; set; }
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,8 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
namespace SharpbinV3.Server.DTOs.User
|
||||
{
|
||||
public class LoginRequest
|
||||
public class LoginUserDto
|
||||
{
|
||||
[StringLength(50, MinimumLength = 3)]
|
||||
public string? Username { get; set; }
|
||||
@@ -10,5 +10,6 @@ namespace SharpbinV3.Server.DTOs
|
||||
[StringLength(128, MinimumLength = 6)]
|
||||
public string? Password { get; set; }
|
||||
public string? Token { get; set; }
|
||||
public string? TotpCode { get; set; }
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
{
|
||||
public partial class RegisterRequest
|
||||
public partial class RegisterUserDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(50, MinimumLength = 3)]
|
||||
+2
-1
@@ -3,12 +3,13 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
{
|
||||
public partial class UpdateUserRequest
|
||||
public partial class UpdateUserDto
|
||||
{
|
||||
public string? DisplayName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public int? Visibility { get; set; } = 0;
|
||||
public int[]? Roles { get; set; }
|
||||
public string? TotpCode { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate()
|
||||
{
|
||||
Reference in New Issue
Block a user