mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
68 lines
1.1 KiB
C#
68 lines
1.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace RadicadeServer.Admin;
|
|
|
|
|
|
|
|
|
|
|
|
public class AdminUser
|
|
{
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public long Id { get; set; }
|
|
|
|
[Required, MaxLength(64)]
|
|
public string Username { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
public string PasswordHash { get; set; } = "";
|
|
|
|
|
|
[MaxLength(64)]
|
|
public string? TotpSecret { get; set; }
|
|
|
|
public bool TotpEnabled { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime? LastLoginAt { get; set; }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class AdminSessionRecord
|
|
{
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public long Id { get; set; }
|
|
|
|
public long AdminUserId { get; set; }
|
|
|
|
|
|
[Required, MaxLength(64)]
|
|
public string TokenHash { get; set; } = "";
|
|
|
|
|
|
|
|
[MaxLength(64)]
|
|
public string? PreviousTokenHash { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime LastSeenAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
public DateTime ExpiresAt { get; set; }
|
|
|
|
public DateTime? RevokedAt { get; set; }
|
|
}
|