This commit is contained in:
2024-12-04 16:28:05 +03:00
parent 0671346ce8
commit 15c801f579
6 changed files with 146 additions and 3 deletions

View File

@ -10,9 +10,11 @@ use kernel\Flash;
use kernel\helpers\Debug;
use kernel\helpers\Files;
use kernel\helpers\RESTClient;
use kernel\helpers\SMTP;
use kernel\modules\module_shop_client\services\ModuleShopClientService;
use kernel\Request;
use kernel\services\ModuleService;
use PHPMailer\PHPMailer\Exception;
class ModuleShopClientController extends AdminController
{
@ -118,4 +120,21 @@ class ModuleShopClientController extends AdminController
$this->redirect('/admin/module_shop_client', 302);
}
/**
* @throws Exception
*/
public function actionAuth(): void
{
$request = new Request();
$address = $request->post("email");
$mail = new SMTP([
'host' => 'smtp.mail.ru',
'port' => 587,
'username' => 'chancellery@itguild.info',
'password' => 'iBdGdxmJk1mnySJYtXc0'
]);
$mail->send($address);
}
}

View File

@ -15,6 +15,7 @@ App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
App::$collector->get('/view/{id}', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionView']);
App::$collector->get('/delete', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionDelete']);
App::$collector->get('/update', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionUpdate']);
App::$collector->post('/auth', [\kernel\modules\module_shop_client\controllers\ModuleShopClientController::class, 'actionAuth']);
});
});
});

View File

@ -9,7 +9,7 @@ echo \kernel\helpers\Html::h(2, "Форма авторизации");
$form = new ActiveForm();
$form->beginForm("/admin/module_shop_client/auth/");
$form->field(\itguild\forms\inputs\TextInput::class, 'key', [
$form->field(\itguild\forms\inputs\TextInput::class, 'email', [
'class' => "form-control",
'placeholder' => 'Email',
])