mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 07:03:35 +08:00
parent
0e1948cd3a
commit
dc2fb05c7f
|
@ -42,7 +42,9 @@ class DeleteAvatarHandler
|
||||||
// Make sure the current user is allowed to edit the user profile.
|
// Make sure the current user is allowed to edit the user profile.
|
||||||
// This will let admins and the user themselves pass through, and
|
// This will let admins and the user themselves pass through, and
|
||||||
// throw an exception otherwise.
|
// throw an exception otherwise.
|
||||||
|
if ($actor->id !== $user->id) {
|
||||||
$user->assertCan($actor, 'edit');
|
$user->assertCan($actor, 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
$avatarPath = $user->avatar_path;
|
$avatarPath = $user->avatar_path;
|
||||||
$user->changeAvatarPath(null);
|
$user->changeAvatarPath(null);
|
||||||
|
|
|
@ -48,7 +48,9 @@ class UploadAvatarHandler
|
||||||
// Make sure the current user is allowed to edit the user profile.
|
// Make sure the current user is allowed to edit the user profile.
|
||||||
// This will let admins and the user themselves pass through, and
|
// This will let admins and the user themselves pass through, and
|
||||||
// throw an exception otherwise.
|
// throw an exception otherwise.
|
||||||
|
if ($actor->id !== $user->id) {
|
||||||
$user->assertCan($actor, 'edit');
|
$user->assertCan($actor, 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
$tmpFile = tempnam(sys_get_temp_dir(), 'avatar');
|
$tmpFile = tempnam(sys_get_temp_dir(), 'avatar');
|
||||||
$command->file->moveTo($tmpFile);
|
$command->file->moveTo($tmpFile);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user