This commit is contained in:
Pig Fang 2020-01-12 11:47:36 +08:00
parent 97ec85b289
commit b816eb1c06

View File

@ -279,16 +279,13 @@ class UserController extends Controller
return json(trans('user.profile.password.wrong-password'), 1);
}
if ($user->changePassword($request->input('new_password'))) {
$dispatcher->dispatch('user.profile.updated', [$user, $action, $addition]);
event(new UserProfileUpdated($action, $user));
$user->changePassword($request->input('new_password'));
$dispatcher->dispatch('user.profile.updated', [$user, $action, $addition]);
event(new UserProfileUpdated($action, $user));
Auth::logout();
Auth::logout();
return json(trans('user.profile.password.success'), 0);
}
break; // @codeCoverageIgnore
return json(trans('user.profile.password.success'), 0);
case 'email':
$this->validate($request, [
@ -332,23 +329,17 @@ class UserController extends Controller
$dispatcher->dispatch('user.deleting', [$user]);
if ($user->delete()) {
$dispatcher->dispatch('user.deleted', [$user]);
session()->flush();
$user->delete();
$dispatcher->dispatch('user.deleted', [$user]);
session()->flush();
return json(trans('user.profile.delete.success'), 0);
}
break; // @codeCoverageIgnore
return json(trans('user.profile.delete.success'), 0);
default:
return json(trans('general.illegal-parameters'), 1);
break;
}
}
// @codeCoverageIgnore
public function setAvatar(Request $request, Filter $filter, Dispatcher $dispatcher)
{
$this->validate($request, ['tid' => 'required|integer']);