mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-22 19:44:02 +08:00
39 lines
909 B
PHP
39 lines
909 B
PHP
<?php
|
|
|
|
namespace App\Services\Logic\Account;
|
|
|
|
use App\Library\Utils\Password as PasswordUtil;
|
|
use App\Services\Logic\Service;
|
|
use App\Validators\Account as AccountValidator;
|
|
use App\Validators\Verify as VerifyValidator;
|
|
|
|
class PasswordReset extends Service
|
|
{
|
|
|
|
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;
|
|
}
|
|
|
|
}
|