From 23015c318a4aa20c717237379e677598deb44f9c Mon Sep 17 00:00:00 2001 From: Argo-Cloud Date: Mon, 26 Oct 2020 17:33:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=20MongoDB=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E6=9F=A5=E6=89=BE=E6=97=B6=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/Bootstrap.DataAccess.MongoDB/User.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/admin/Bootstrap.DataAccess.MongoDB/User.cs b/src/admin/Bootstrap.DataAccess.MongoDB/User.cs index be5762c7..1588c7b6 100644 --- a/src/admin/Bootstrap.DataAccess.MongoDB/User.cs +++ b/src/admin/Bootstrap.DataAccess.MongoDB/User.cs @@ -156,7 +156,7 @@ namespace Bootstrap.DataAccess.MongoDB var passSalt = LgbCryptography.GenerateSalt(); var newPassword = LgbCryptography.ComputeHash(newPass, passSalt); var update = Builders.Update.Set(u => u.Password, newPassword).Set(u => u.PassSalt, passSalt); - DbManager.Users.FindOneAndUpdate(u => u.UserName == UserName, update); + DbManager.Users.FindOneAndUpdate(u => u.UserName.ToUpperInvariant() == UserName.ToUpperInvariant(), update); ret = true; } return ret; @@ -275,7 +275,7 @@ namespace Bootstrap.DataAccess.MongoDB var passSalt = LgbCryptography.GenerateSalt(); var newPassword = LgbCryptography.ComputeHash(password, passSalt); DbManager.Users.UpdateOne(User => User.UserName.ToLowerInvariant() == userName.ToLowerInvariant(), Builders.Update.Set(md => md.Password, newPassword).Set(md => md.PassSalt, passSalt).Set(md => md.IsReset, 0)); - DbManager.ResetUsers.DeleteMany(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()); + DbManager.ResetUsers.DeleteMany(user => user.UserName.ToUpperInvariant() == userName.ToUpperInvariant()); return true; }