mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-04-23 12:39:36 +08:00

* 匹配房间 第一部分 * elo匹配 * 设置匹配结束标记 * 传输的room对象错误 * 修复错误的UpdateRoom; 添加SQLMode开关 * 删除创建房间时重复的加入房间代码 * 添加在加入房间时检查是否存在房间 --------- Co-authored-by: yeziuku <yezi@wrss.org>
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using Milimoe.FunGame.Core.Api.Transmittal;
|
|
using Milimoe.FunGame.Core.Api.Utility;
|
|
using Milimoe.FunGame.Core.Library.Constant;
|
|
using Milimoe.FunGame.Server.Model;
|
|
|
|
namespace Milimoe.FunGame.Server.Controllers
|
|
{
|
|
public class Authenticator : Core.Library.Common.Architecture.Authenticator
|
|
{
|
|
public TwoFactorAuthenticator Login2FA = new();
|
|
|
|
private readonly ServerModel Server;
|
|
private readonly SQLHelper SQLHelper;
|
|
private readonly MailSender? MailSender;
|
|
|
|
public Authenticator(ServerModel Server, SQLHelper SQLHelper, MailSender? MailSender) : base(SQLHelper)
|
|
{
|
|
this.Server = Server;
|
|
this.SQLHelper = SQLHelper;
|
|
this.MailSender = MailSender;
|
|
}
|
|
|
|
public override bool AfterAuthenticator(AuthenticationType type, params object[] args)
|
|
{
|
|
if (type == AuthenticationType.Username)
|
|
{
|
|
// 添加2FA二次验证等
|
|
string username = (string)args[0];
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override bool BeforeAuthenticator(AuthenticationType type, params object[] args)
|
|
{
|
|
// 添加人机验证或频繁验证等
|
|
return true;
|
|
}
|
|
|
|
public bool Check2FA(string username, string code)
|
|
{
|
|
return Login2FA.Authenticate(username, code);
|
|
}
|
|
}
|
|
}
|