feat: implement account binding functionality for GitHub and LinuxDo

This commit is contained in:
shiyu
2025-06-01 15:05:26 +08:00
parent c458f3c6f7
commit d76bf5b751
17 changed files with 670 additions and 64 deletions

View File

@@ -14,6 +14,8 @@ public class User : BaseModel
[Required] [StringLength(255)] public required string PasswordHash { get; set; }
[StringLength(255)] public string? GithubId { get; set; }
[StringLength(255)] public string? LinuxDoId { get; set; }
public int? RoleId { get; set; }
public Role? Role { get; set; }

View File

@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
namespace Foxel.Models.Request.Auth;
public class BindAccountRequest
{
[Required(ErrorMessage = "邮箱不能为空")]
[EmailAddress(ErrorMessage = "邮箱格式不正确")]
public string Email { get; set; } = string.Empty;
[Required(ErrorMessage = "密码不能为空")]
[MinLength(6, ErrorMessage = "密码长度不能少于6位")]
public string Password { get; set; } = string.Empty;
[Required(ErrorMessage = "绑定类型不能为空")] public BindType BindType { get; set; }
[Required(ErrorMessage = "第三方用户ID不能为空")]
public string ThirdPartyUserId { get; set; } = string.Empty;
}
public enum BindType
{
GitHub,
LinuxDo
}