fixed password

This commit is contained in:
Edward Yang 2022-08-22 18:05:11 +08:00
parent f394b20d31
commit dffc6e6799
3 changed files with 22 additions and 18 deletions

View File

@ -45,10 +45,10 @@ class AccountController extends Controller
public function updatePassword(ForgottenRequest $request): array public function updatePassword(ForgottenRequest $request): array
{ {
if (Hash::make($request->get('origin_password')) != current_customer()->getAuthPassword()) { if (Hash::make($request->get('origin_password')) != current_customer()->getAuthPassword()) {
throw new \Exception("原密码错误"); throw new \Exception(trans('shop/account.edit.origin_password_fail'));
} }
CustomerRepo::update(current_customer(), ['password' => $request->get('password')]); CustomerRepo::update(current_customer(), ['password' => $request->get('password')]);
return json_success('密码修改成功'); return json_success(trans('shop/account.edit.password_edit_success'));
} }
} }

View File

@ -30,11 +30,13 @@ return [
'edit' => [ 'edit' => [
'index' => 'Edit', 'index' => 'Edit',
'modify_avatar' => 'modify avatar', 'modify_avatar' => 'Modify Avatar',
'suggest' => 'Upload a JPG or PNG image. 300 x 300 is recommended.', 'suggest' => 'Upload a JPG or PNG image. 300 x 300 is recommended.',
'name' => 'name', 'name' => 'Name',
'email' => 'email', 'email' => 'Email',
'crop' => 'crop', 'crop' => 'crop',
'password_edit_success' => 'Change password successfully!',
'origin_password_fail' => 'Origin password incorrect!',
], ],
'wishlist' => [ 'wishlist' => [

View File

@ -35,6 +35,8 @@ return [
'name' => '名称', 'name' => '名称',
'email' => '邮箱', 'email' => '邮箱',
'crop' => '裁剪', 'crop' => '裁剪',
'password_edit_success' => '密码修改成功',
'origin_password_fail' => '原密码错误',
], ],
'wishlist' => [ 'wishlist' => [