懒得勤快 5 년 전
부모
커밋
45922a1d2d
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      src/Masuit.MyBlogs.Core/Controllers/PassportController.cs

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

@@ -57,8 +57,8 @@ namespace Masuit.MyBlogs.Core.Controllers
         public ActionResult Login()
         {
             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"];
             if (!string.IsNullOrEmpty(from))
             {
@@ -130,7 +130,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                 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);
             if (userInfo == null)
             {