Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song committed Nov 3, 2020
1 parent 22f2255 commit 7a405d4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Admin
*
* @var string
*/
const VERSION = '1.8.9';
const VERSION = '1.8.10';

/**
* @var Navbar
Expand Down
22 changes: 19 additions & 3 deletions src/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,24 @@ public function handle($request, Closure $next)
*/
protected function shouldPassThrough($request)
{
$except = trim(admin_base_path('auth/login'), '/');

return $request->is($except);
// 下面的路由不验证登陆
$excepts = config('admin.auth.excepts', []);

array_delete($excepts, [
'_handle_action_',
'_handle_form_',
'_handle_selectable_',
'_handle_renderable_',
]);

return collect($excepts)
->map('admin_base_path')
->contains(function ($except) use ($request) {
if ($except !== '/') {
$except = trim($except, '/');
}

return $request->is($except);
});
}
}
1 change: 1 addition & 0 deletions src/Middleware/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function checkRoutePermission(Request $request)
*/
protected function shouldPassThrough($request)
{
// 下面这些路由不验证权限
$excepts = array_merge(config('admin.auth.excepts', []), [
'auth/login',
'auth/logout',
Expand Down
4 changes: 3 additions & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ function admin_trans($key = null, $replace = [], $locale = null)
*/
function array_delete(&$array, $value)
{
$value = \Illuminate\Support\Arr::wrap($value);

foreach ($array as $index => $item) {
if ($value == $item) {
if (in_array($item, $value)) {
unset($array[$index]);
}
}
Expand Down

0 comments on commit 7a405d4

Please sign in to comment.