mirror of
https://github.com/v2board/v2board.git
synced 2024-11-13 02:59:10 +08:00
update: fix user generate
This commit is contained in:
parent
a6d5a433b0
commit
b40272a8fa
@ -7,6 +7,7 @@ use App\Services\TelegramService;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Utils\Dict;
|
use App\Utils\Dict;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class ConfigController extends Controller
|
class ConfigController extends Controller
|
||||||
{
|
{
|
||||||
@ -32,6 +33,25 @@ class ConfigController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSendEmail(Request $request)
|
||||||
|
{
|
||||||
|
$email = $request->session()->get('email');
|
||||||
|
$subject = 'Test Message';
|
||||||
|
try {
|
||||||
|
Mail::raw(
|
||||||
|
'Test Message',
|
||||||
|
function ($message) use ($email, $subject) {
|
||||||
|
$message->to($email)->subject($subject);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
abort(500, $e->getMessage());
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function setTelegramWebhook(Request $request)
|
public function setTelegramWebhook(Request $request)
|
||||||
{
|
{
|
||||||
$telegramService = new TelegramService($request->input('telegram_bot_token'));
|
$telegramService = new TelegramService($request->input('telegram_bot_token'));
|
||||||
|
@ -179,6 +179,9 @@ class UserController extends Controller
|
|||||||
'uuid' => Helper::guid(true),
|
'uuid' => Helper::guid(true),
|
||||||
'token' => Helper::guid()
|
'token' => Helper::guid()
|
||||||
];
|
];
|
||||||
|
if (User::where('email', $user['email'])->first()) {
|
||||||
|
abort(500, '邮箱已存在于系统中');
|
||||||
|
}
|
||||||
$user['password'] = password_hash($request->input('password') ?? $user['email'], PASSWORD_DEFAULT);
|
$user['password'] = password_hash($request->input('password') ?? $user['email'], PASSWORD_DEFAULT);
|
||||||
if (!User::create($user)) {
|
if (!User::create($user)) {
|
||||||
abort(500, '生成失败');
|
abort(500, '生成失败');
|
||||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
2
public/theme/v2board/assets/umi.js
vendored
2
public/theme/v2board/assets/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user