Skip to content

Commit e35e113

Browse files
committed
修复:后台自动跳转到第一个有权限菜单异常问题
1 parent 7170a8f commit e35e113

11 files changed

Lines changed: 110 additions & 8 deletions

File tree

artisan

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ require __DIR__.'/vendor/autoload.php';
1919

2020
$app = require_once __DIR__.'/bootstrap/app.php';
2121

22+
if (\ModStart\Core\Util\PlatformUtil::isLinux()) {
23+
if (function_exists('posix_getuid')) {
24+
$uid = posix_getuid();
25+
if ($uid == 0) {
26+
echo "You can't run this command as root ( uid = ${uid} ).\n";
27+
exit(-1);
28+
}
29+
}
30+
}
31+
2232
/*
2333
|--------------------------------------------------------------------------
2434
| Run The Artisan Application

module/Member/Api/Controller/AuthController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ public function oauthTryLogin($oauthType = null)
173173
return Response::generateSuccessData($resultData);
174174
}
175175
if (modstart_config('Member_OauthBindAuto', false)) {
176+
// 已登录直接绑定
177+
if (MemberUser::isLogin()) {
178+
$memberUserId = MemberUser::id();
179+
$ret = $oauth->processBindToUser([
180+
'memberUserId' => $memberUserId,
181+
'userInfo' => $oauthUserInfo,
182+
]);
183+
BizException::throwsIfResponseError($ret);
184+
Session::forget('oauthUserInfo');
185+
$resultData['memberUserId'] = $memberUserId;
186+
return Response::generateSuccessData($resultData);
187+
}
176188
// 快速注册
177189
/** 为了兼容统一登录,禁止使用手机号格式和邮箱格式 */
178190
$username = null;

module/Member/Docs/release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- 优化:手机快速注册登录密码设置控件不是password修复
44
- 优化:VIP设置赠送积分但积分设置为0时异常问题
5+
- 修复:已登录绑定授权信息,开启自动绑定账户时,绑定账户异常问题
56

67
---
78

module/Vendor/View/mail/frame.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
@show
3333
</div>
3434
<div id="foot">
35-
{{modstart_config('siteName')}} &copy; {{modstart_config('siteDomain')}}
35+
{{modstart_config('siteName')}}
36+
{!! modstart_config('siteDomain','')?'&copy;'.modstart_config('siteDomain',''):'' !!}
3637
</div>
3738
@show
3839
</div>

vendor/modstart/modstart/lang/zh/base.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'Security Warning' => '安全警告',
3131
'System in debug mode ( APP_DEBUG=true ), error messages may expose sensitive data.' => '系统为调试模式 ( APP_DEBUG=true ),错误信息可能暴露敏感信息。',
3232
'install.php script not deleted, may expose sensitive data' => 'install.php 安装向导文件未删除,可能暴露敏感信息',
33+
'Your password is weak, please change your password.' => '您的正在使用弱密码,请及时修改密码。',
3334
'Visit Home' => '访问首页',
3435
'Home' => '首页',
3536
'Admin Login' => '管理登录',

vendor/modstart/modstart/src/Admin/Middleware/AuthMiddleware.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ public function handle($request, Closure $next)
147147
// 如果是首页,尝试跳转到第一个有权限的页面
148148
foreach ($rules as $_ => $ruleInfo) {
149149
if (!empty($ruleInfo['auth'])) {
150-
return Response::redirect(action($ruleInfo['url']));
150+
// 如果是 URL,直接跳转,如果是 Controller@method,尝试调用
151+
$url = $ruleInfo['url'];
152+
if (AdminPermission::isUrlAction($ruleInfo['url'])) {
153+
$url = action($ruleInfo['url']);
154+
}
155+
return Response::redirect($url);
151156
}
152157
}
153158
}

vendor/modstart/modstart/src/Core/Util/ShellUtil.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,30 @@ public static function runInNewProcess($command, $log = true)
6666
return $ret;
6767
}
6868

69+
public static function runWithTimeout($command, $timeout = 60, $log = true)
70+
{
71+
if ($log) {
72+
Log::info("ShellUtil.Run -> " . $command);
73+
}
74+
$process = new Process($command);
75+
$process->setTimeout($timeout);
76+
try {
77+
$process->start();
78+
$process->wait();
79+
$ret = $process->getOutput();
80+
$ret = @trim($ret);
81+
if ($log) {
82+
Log::info("ShellUtil.Result -> " . $ret);
83+
}
84+
return $ret;
85+
} catch (\Exception $e) {
86+
if ($log) {
87+
Log::error("ShellUtil.Error -> " . $e->getMessage());
88+
}
89+
return "ERROR:" . $e->getMessage();
90+
}
91+
}
92+
6993
/**
7094
* @param $commandFilter
7195
* @return array|string|null

vendor/modstart/modstart/src/Widget/Nav.php

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class Nav extends AbstractWidget
2323
*/
2424
protected $classList = '';
2525

26+
/**
27+
* @var string
28+
*/
29+
protected $attributes = '';
30+
2631
/**
2732
* Box constructor.
2833
*
@@ -35,7 +40,7 @@ public function __construct($navs, $classList = '')
3540
$this->classList = $classList;
3641
}
3742

38-
public static function make($navs, $classList = '')
43+
public static function make($navs = [], $classList = '')
3944
{
4045
return new static($navs, $classList);
4146
}
@@ -52,6 +57,36 @@ public function classList($classList)
5257
return $this;
5358
}
5459

60+
public function attributes($attributes)
61+
{
62+
$this->attributes = $attributes;
63+
return $this;
64+
}
65+
66+
public function append($title, $url, $active = false)
67+
{
68+
$this->navs[] = [
69+
'title' => $title,
70+
'url' => $url,
71+
'active' => $active,
72+
];
73+
return $this;
74+
}
75+
76+
public function appendDialog($title, $url, $active = false, $width = null, $height = null)
77+
{
78+
$this->navs[] = [
79+
'title' => $title,
80+
'dialog' => [
81+
'url' => $url,
82+
'width' => $width,
83+
'height' => $height,
84+
],
85+
'active' => $active,
86+
];
87+
return $this;
88+
}
89+
5590
/**
5691
* Variables in view.
5792
*

vendor/modstart/modstart/views/admin/widget/securityTooltipBox.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<div class="ub-alert warning">
3939
<i class="iconfont icon-warning"></i>
4040
{{L('Security Warning')}}: {{L('Your password is weak, please change your password.')}}
41-
<a href="{{action('\ModStart\Admin\Controller\AdminUserController@changePassword')}}">{{L('Process Now')}}</a>
41+
<a href="{{action('\ModStart\Admin\Controller\ProfileController@changePassword')}}">{{L('Process Now')}}</a>
4242
</div>
4343
@endif
4444
@if(config('env.APP_KEY')=='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')

vendor/modstart/modstart/views/core/field/tags.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class="form"
4040
var $field = $('#{{$id}}');
4141
var $tag = $('#{{$id}}Tags').tagify({
4242
whitelist : {!! \ModStart\Core\Util\SerializeUtil::jsonEncode(array_values($tags)) !!},
43+
enforceWhitelist: false,
4344
dropdown: {
4445
maxItems: 20,
4546
classname: "tagify-dropdown-list",

0 commit comments

Comments
 (0)