yzx преди 7 месеца
родител
ревизия
ab58fc2449
променени са 1 файла, в които са добавени 11 реда и са изтрити 8 реда
  1. 11 8
      app/admin/middleware/Auth.php

+ 11 - 8
app/admin/middleware/Auth.php

@@ -74,8 +74,7 @@ class Auth
             "admin/project.api/get_sent_review",
             "admin/project.api/get_sent_review_people",
             
-            "admin/datastat.datastat/test"
-
+            "admin/datastat.datastat/test",
         ];
     }
 
@@ -108,18 +107,22 @@ class Auth
 
 
             $uid = Session::get($session_admin)['id'];
-
-
             // 检查上次密码更换时间
             $lastPasswordChange = Db::name('Admin')->where('id', $uid)->value('last_password_change');
 
-            if ($lastPasswordChange && $pathInfo != "api/edit_password.") {
-
-                $daysSinceLastChange = (time() - strtotime($lastPasswordChange)) / (60 * 60 * 24);
-                if ($daysSinceLastChange > 180) {
+            if($pathInfo != "api/password_submit"){
+                // 检查是否需要更新密码
+                if ($lastPasswordChange === null && $pathInfo != "api/edit_password.") {
                     redirect('/admin/api/edit_password.html')->send();
+                } else if ($lastPasswordChange != null && $pathInfo != "api/edit_password.") {
+
+                    $daysSinceLastChange = (time() - $lastPasswordChange) / (60 * 60 * 24);
+                    if ($daysSinceLastChange > 180) {
+                        redirect('/admin/api/edit_password.html')->send();
+                    }
                 }
             }
+
             //验证用户访问权限
             // if ($action !== 'index' && $action !== 'api') {
             //     if (!$this->checkAuth($controller, $pathInfo, $action, $uid)) {