From 707f3b8516f8d390cf070c7578a2d09448610596 Mon Sep 17 00:00:00 2001 From: Argo-Surface Date: Fri, 22 Feb 2019 11:51:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DMongoDB=E6=95=B0=E6=8D=AE=E5=BA=93=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=90=8D=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F=E5=86=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E8=A7=81?= =?UTF-8?q?Issue=20#IRWKA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.DataAccess.MongoDB/Role.cs | 2 +- Bootstrap.DataAccess.MongoDB/User.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Bootstrap.DataAccess.MongoDB/Role.cs b/Bootstrap.DataAccess.MongoDB/Role.cs index c80510ff..e79d7fc1 100644 --- a/Bootstrap.DataAccess.MongoDB/Role.cs +++ b/Bootstrap.DataAccess.MongoDB/Role.cs @@ -73,7 +73,7 @@ namespace Bootstrap.DataAccess.MongoDB public override IEnumerable RetrieveRolesByUserName(string userName) { var roles = new List(); - var user = UserHelper.Retrieves().Cast().FirstOrDefault(u => u.UserName == userName); + var user = UserHelper.Retrieves().Cast().FirstOrDefault(u => u.UserName.ToLowerInvariant() == userName.ToLowerInvariant()); var role = RoleHelper.Retrieves(); roles.AddRange(user.Roles.Select(r => role.FirstOrDefault(rl => rl.Id == r).RoleName)); diff --git a/Bootstrap.DataAccess.MongoDB/User.cs b/Bootstrap.DataAccess.MongoDB/User.cs index 53b08715..2a566658 100644 --- a/Bootstrap.DataAccess.MongoDB/User.cs +++ b/Bootstrap.DataAccess.MongoDB/User.cs @@ -34,7 +34,7 @@ namespace Bootstrap.DataAccess.MongoDB .Include(u => u.DisplayName) .Include(u => u.Icon) .Include(u => u.Css); - return DbManager.Users.Find(user => user.UserName == userName).Project(project).FirstOrDefault(); + return DbManager.Users.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).Project(project).FirstOrDefault(); } /// @@ -47,7 +47,7 @@ namespace Bootstrap.DataAccess.MongoDB { if (string.IsNullOrEmpty(userName) && string.IsNullOrEmpty(password)) return false; - var u = DbManager.Users.Find(user => user.UserName.Equals(userName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); + var u = DbManager.Users.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).FirstOrDefault(); return !string.IsNullOrEmpty(u.PassSalt) && u.Password == LgbCryptography.ComputeHash(password, u.PassSalt); }