作者 Karson

修复在分层控制器下的权限验证错误

修复表单在提交后未返回token时导致的客户端错误
@@ -117,7 +117,7 @@ class Backend extends Controller @@ -117,7 +117,7 @@ class Backend extends Controller
117 if (!$this->auth->match($this->noNeedRight)) 117 if (!$this->auth->match($this->noNeedRight))
118 { 118 {
119 // 判断控制器和方法判断是否有对应权限 119 // 判断控制器和方法判断是否有对应权限
120 - $path = $this->request->path(); 120 + $path = str_replace('.', '/', $this->request->path());
121 $path = substr($path, 0, 1) == '/' ? $path : '/' . $path; 121 $path = substr($path, 0, 1) == '/' ? $path : '/' . $path;
122 if (!$this->auth->check($path)) 122 if (!$this->auth->check($path))
123 { 123 {
@@ -51,7 +51,7 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], func @@ -51,7 +51,7 @@ define(['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], func
51 } 51 }
52 Toastr.success(msg ? msg : __('Operation completed')); 52 Toastr.success(msg ? msg : __('Operation completed'));
53 } else { 53 } else {
54 - if (typeof data.token !== 'undefined') { 54 + if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
55 $("input[name='__token__']").val(data.token); 55 $("input[name='__token__']").val(data.token);
56 } 56 }
57 Toastr.error(msg ? msg : __('Operation failed')); 57 Toastr.error(msg ? msg : __('Operation failed'));