1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 04:21:27 +08:00
2020-05-04 19:13:33 +08:00

36 lines
754 B
PHP

<?php
namespace App\Services\Frontend\Account;
use App\Repos\Account as AccountRepo;
use App\Services\Frontend\Service;
use App\Validators\Account as AccountValidator;
class PasswordUpdate extends Service
{
public function handle()
{
$post = $this->request->getPost();
$user = $this->getLoginUser();
$accountRepo = new AccountRepo();
$account = $accountRepo->findById($user->id);
$accountValidator = new AccountValidator();
$accountValidator->checkOriginPassword($account, $post['origin_password']);
$newPassword = $accountValidator->checkPassword($post['new_password']);
$account->password = $newPassword;
$account->update();
return $account;
}
}