This commit is contained in:
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
@@ -201,5 +202,19 @@ namespace Ewide.Core.Common
|
||||
{
|
||||
UpdateWhiteListUser(userID);
|
||||
}
|
||||
|
||||
public static string GetPasswordMD5(string password)
|
||||
{
|
||||
var str = password.Trim().ToLower();
|
||||
|
||||
str = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(UTF8Encoding.Default.GetBytes(str))).Replace("-", "");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static bool IsAuthorized()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace Ewide.Core.WebApi
|
||||
// 500
|
||||
config.Services.Replace(typeof(IHttpActionInvoker), new HttpWebApiControllerActionInvoker(config));
|
||||
#endregion
|
||||
|
||||
config.Filters.Add(new ValidateArgumentsFilter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.Web.Http;
|
||||
|
||||
namespace Ewide.Core.WebApi.Areas.Base.Controllers
|
||||
{
|
||||
[ValidateArgumentsFilter]
|
||||
public class GateController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,10 +15,15 @@ namespace Ewide.Core.WebApi.Areas.Base.Controllers
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[ValidateArgumentsFilter(AllowNull = true)]
|
||||
public IHttpActionResult Login(LoginDTO dto)
|
||||
{
|
||||
return DisplayJSON(dto);
|
||||
}
|
||||
|
||||
[ValidateArgumentsFilter(AllowNull = true)]
|
||||
public IHttpActionResult AllowNullAPI(LoginDTO dto)
|
||||
{
|
||||
return DisplayJSON(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Web.Http.Filters;
|
||||
|
||||
namespace Ewide.Core.WebApi
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
|
||||
public class ValidateArgumentsFilter : ActionFilterAttribute
|
||||
{
|
||||
public bool AllowNull { get; set; } = false;
|
||||
|
||||
Reference in New Issue
Block a user