懒得勤快 5 anos atrás
pai
commit
45922a1d2d

+ 3 - 3
src/Masuit.MyBlogs.Core/Controllers/PassportController.cs

@@ -57,8 +57,8 @@ namespace Masuit.MyBlogs.Core.Controllers
         public ActionResult Login()
         public ActionResult Login()
         {
         {
             var keys = RsaCrypt.GenerateRsaKeys(RsaKeyType.PEM);
             var keys = RsaCrypt.GenerateRsaKeys(RsaKeyType.PEM);
-            Response.Cookies.Append("PublicKey", keys.PublicKey);
-            HttpContext.Session.Set("PrivateKey", keys.PrivateKey);
+            Response.Cookies.Append(nameof(keys.PublicKey), keys.PublicKey);
+            HttpContext.Session.Set(nameof(keys.PrivateKey), keys.PrivateKey);
             string from = Request.Query["from"];
             string from = Request.Query["from"];
             if (!string.IsNullOrEmpty(from))
             if (!string.IsNullOrEmpty(from))
             {
             {
@@ -130,7 +130,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                 return ResultData(null, false, "用户名或密码不能为空");
                 return ResultData(null, false, "用户名或密码不能为空");
             }
             }
 
 
-            password = password.RSADecrypt(HttpContext.Session.Get<string>("PrivateKey"));
+            password = password.RSADecrypt(HttpContext.Session.Get<string>(nameof(RsaKey.PrivateKey)));
             var userInfo = UserInfoService.Login(username, password);
             var userInfo = UserInfoService.Login(username, password);
             if (userInfo == null)
             if (userInfo == null)
             {
             {