update: fix admin editor

This commit is contained in:
tokumeikoi 2021-08-05 14:48:24 +09:00
parent d95974019a
commit 00cd3e26be
8 changed files with 30 additions and 12 deletions

View File

@ -136,9 +136,6 @@ class ConfigController extends Controller
'server_v2ray_domain' => config('v2board.server_v2ray_domain'), 'server_v2ray_domain' => config('v2board.server_v2ray_domain'),
'server_v2ray_protocol' => config('v2board.server_v2ray_protocol'), 'server_v2ray_protocol' => config('v2board.server_v2ray_protocol'),
], ],
'tutorial' => [
'apple_id' => config('v2board.apple_id')
],
'email' => [ 'email' => [
'email_template' => config('v2board.email_template', 'default'), 'email_template' => config('v2board.email_template', 'default'),
'email_host' => config('v2board.email_host'), 'email_host' => config('v2board.email_host'),

View File

@ -35,8 +35,6 @@ class KnowledgeController extends Controller
} }
$subscribeUrl = "{$subscribeUrl}/api/v1/client/subscribe?token={$user['token']}"; $subscribeUrl = "{$subscribeUrl}/api/v1/client/subscribe?token={$user['token']}";
$knowledge['body'] = str_replace('{{siteName}}', config('v2board.app_name', 'V2Board'), $knowledge['body']); $knowledge['body'] = str_replace('{{siteName}}', config('v2board.app_name', 'V2Board'), $knowledge['body']);
$knowledge['body'] = str_replace('{{appleId}}', $appleId, $knowledge['body']);
$knowledge['body'] = str_replace('{{appleIdPassword}}', $appleIdPassword, $knowledge['body']);
$knowledge['body'] = str_replace('{{subscribeUrl}}', $subscribeUrl, $knowledge['body']); $knowledge['body'] = str_replace('{{subscribeUrl}}', $subscribeUrl, $knowledge['body']);
$knowledge['body'] = str_replace('{{urlEncodeSubscribeUrl}}', urlencode($subscribeUrl), $knowledge['body']); $knowledge['body'] = str_replace('{{urlEncodeSubscribeUrl}}', urlencode($subscribeUrl), $knowledge['body']);
$knowledge['body'] = str_replace( $knowledge['body'] = str_replace(

View File

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\User\UserTransfer; use App\Http\Requests\User\UserTransfer;
use App\Http\Requests\User\UserUpdate; use App\Http\Requests\User\UserUpdate;
use App\Http\Requests\User\UserChangePassword; use App\Http\Requests\User\UserChangePassword;
use App\Utils\CacheKey;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\User; use App\Models\User;
use App\Models\Plan; use App\Models\Plan;
@ -14,6 +15,7 @@ use App\Models\Ticket;
use App\Utils\Helper; use App\Utils\Helper;
use App\Models\Order; use App\Models\Order;
use App\Models\ServerLog; use App\Models\ServerLog;
use Illuminate\Support\Facades\Cache;
class UserController extends Controller class UserController extends Controller
{ {
@ -204,4 +206,26 @@ class UserController extends Controller
} }
return null; return null;
} }
public function getQuickLoginUrl(Request $request)
{
$user = User::find($request->session()->get('id'));
if (!$user) {
abort(500, __('The user does not exist'));
}
$code = Helper::guid();
$key = CacheKey::get('TEMP_TOKEN', $code);
Cache::put($key, $user->id, 60);
$redirect = '/#/login?verify=' . $code . '&redirect=' . ($request->input('redirect') ? $request->input('redirect') : 'dashboard');
if (config('v2board.app_url')) {
$url = config('v2board.app_url') . $redirect;
} else {
$url = url($redirect);
}
return response([
'data' => $url
]);
}
} }

View File

@ -15,8 +15,9 @@ class User
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($request->input('auth_data')) { $authorization = $request->input('auth_data') ?? $request->header('authorization');
$authData = explode(':', base64_decode($request->input('auth_data'))); if ($authorization) {
$authData = explode(':', base64_decode($authorization));
if (!isset($authData[1]) || !isset($authData[0])) abort(403, '鉴权失败,请重新登入'); if (!isset($authData[1]) || !isset($authData[0])) abort(403, '鉴权失败,请重新登入');
$user = \App\Models\User::where('password', $authData[1]) $user = \App\Models\User::where('password', $authData[1])
->where('email', $authData[0]) ->where('email', $authData[0])

View File

@ -93,9 +93,6 @@ class ConfigSave extends FormRequest
'frontend_admin_path' => '', 'frontend_admin_path' => '',
'frontend_customer_service_method' => '', 'frontend_customer_service_method' => '',
'frontend_customer_service_id' => '', 'frontend_customer_service_id' => '',
// tutorial
'apple_id' => 'nullable|email',
'apple_id_password' => '',
// email // email
'email_template' => '', 'email_template' => '',
'email_host' => '', 'email_host' => '',

View File

@ -20,6 +20,7 @@ class UserRoute
$router->get ('/getSubscribe', 'User\\UserController@getSubscribe'); $router->get ('/getSubscribe', 'User\\UserController@getSubscribe');
$router->get ('/getStat', 'User\\UserController@getStat'); $router->get ('/getStat', 'User\\UserController@getStat');
$router->post('/transfer', 'User\\UserController@transfer'); $router->post('/transfer', 'User\\UserController@transfer');
$router->post('/getQuickLoginUrl', 'User\\UserController@getQuickLoginUrl');
// Order // Order
$router->post('/order/save', 'User\\OrderController@save'); $router->post('/order/save', 'User\\OrderController@save');
$router->post('/order/checkout', 'User\\OrderController@checkout'); $router->post('/order/checkout', 'User\\OrderController@checkout');

View File

@ -236,5 +236,5 @@ return [
| The only modification by laravel config | The only modification by laravel config
| |
*/ */
'version' => '1.5.3.1627561785242' 'version' => '1.5.3.1628142492488'
]; ];

File diff suppressed because one or more lines are too long