mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00
Add more authenticators
This commit is contained in:
parent
c3c153635f
commit
6876430f7a
@ -1,5 +1,7 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||||
|
using Milimoe.FunGame.Core.Library.SQLScript.Entity;
|
||||||
|
|
||||||
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||||
{
|
{
|
||||||
@ -12,6 +14,21 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
|||||||
this.SQLHelper = SQLHelper;
|
this.SQLHelper = SQLHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Authenticate(string script)
|
||||||
|
{
|
||||||
|
SQLHelper.ExecuteDataSet(script);
|
||||||
|
if (SQLHelper.Success)
|
||||||
|
{
|
||||||
|
DataSet ds = SQLHelper.DataSet;
|
||||||
|
if (ds.Tables.Count > 0 &&
|
||||||
|
ds.Tables[0].Rows.Count > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Authenticate<T>(string script, string column, T keyword)
|
public bool Authenticate<T>(string script, string column, T keyword)
|
||||||
{
|
{
|
||||||
SQLHelper.ExecuteDataSet(script);
|
SQLHelper.ExecuteDataSet(script);
|
||||||
@ -28,5 +45,23 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Authenticate(string script, string username, string password)
|
||||||
|
{
|
||||||
|
SQLHelper.ExecuteDataSet(script);
|
||||||
|
if (SQLHelper.Success)
|
||||||
|
{
|
||||||
|
DataSet ds = SQLHelper.DataSet;
|
||||||
|
if (ds.Tables.Count > 0 &&
|
||||||
|
ds.Tables[0].Columns.Contains(UserQuery.Column_Username) &&
|
||||||
|
ds.Tables[0].Columns.Contains(UserQuery.Column_Password) &&
|
||||||
|
ds.Tables[0].Rows.Count > 0 &&
|
||||||
|
ds.Tables[0].AsEnumerable().Where(row => (string)row[UserQuery.Column_Username] == username && (string)row[UserQuery.Column_Password] == password).Any())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user