mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 12:05:39 +08:00
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
|
* @license https://opensource.org/licenses/GPL-2.0
|
|
* @link https://www.koogua.com
|
|
*/
|
|
|
|
namespace App\Services\Logic\Account;
|
|
|
|
use App\Library\Utils\Password as PasswordUtil;
|
|
use App\Services\Logic\Service as LogicService;
|
|
use App\Validators\Account as AccountValidator;
|
|
use App\Validators\Verify as VerifyValidator;
|
|
|
|
class PasswordReset extends LogicService
|
|
{
|
|
|
|
public function handle()
|
|
{
|
|
$post = $this->request->getPost();
|
|
|
|
$accountValidator = new AccountValidator();
|
|
|
|
$account = $accountValidator->checkAccount($post['account']);
|
|
|
|
$newPassword = $accountValidator->checkPassword($post['new_password']);
|
|
|
|
$verifyValidator = new VerifyValidator();
|
|
|
|
$verifyValidator->checkCode($post['account'], $post['verify_code']);
|
|
|
|
$salt = PasswordUtil::salt();
|
|
$password = PasswordUtil::hash($newPassword, $salt);
|
|
|
|
$account->salt = $salt;
|
|
$account->password = $password;
|
|
|
|
$account->update();
|
|
|
|
return $account;
|
|
}
|
|
|
|
}
|