mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 00:33:17 +00:00
Merge pull request #1053 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
83cfaa0c7d
3 changed files with 40 additions and 9 deletions
|
@ -49,8 +49,8 @@ class LoginController extends Controller
|
||||||
public function validateLogin($request)
|
public function validateLogin($request)
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
$this->username() => 'required|string',
|
$this->username() => 'required|email',
|
||||||
'password' => 'required|string',
|
'password' => 'required|string|min:6',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (config('pixelfed.recaptcha')) {
|
if (config('pixelfed.recaptcha')) {
|
||||||
|
@ -70,6 +70,10 @@ class LoginController extends Controller
|
||||||
*/
|
*/
|
||||||
protected function authenticated($request, $user)
|
protected function authenticated($request, $user)
|
||||||
{
|
{
|
||||||
|
if($user->status == 'deleted') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$log = new AccountLog();
|
$log = new AccountLog();
|
||||||
$log->user_id = $user->id;
|
$log->user_id = $user->id;
|
||||||
$log->item_id = $user->id;
|
$log->item_id = $user->id;
|
||||||
|
|
|
@ -176,6 +176,7 @@ class SettingsController extends Controller
|
||||||
$profile->save();
|
$profile->save();
|
||||||
Cache::forget('profiles:private');
|
Cache::forget('profiles:private');
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
|
DeleteAccountPipeline::dispatch($user);
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ use App\{
|
||||||
StatusHashtag,
|
StatusHashtag,
|
||||||
Status,
|
Status,
|
||||||
User,
|
User,
|
||||||
|
UserDevice,
|
||||||
UserFilter,
|
UserFilter,
|
||||||
UserSetting,
|
UserSetting,
|
||||||
};
|
};
|
||||||
|
@ -66,7 +67,9 @@ class DeleteAccountPipeline implements ShouldQueue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::transaction(function() use ($user) {
|
||||||
if($user->profile) {
|
if($user->profile) {
|
||||||
$avatar = $user->profile->avatar;
|
$avatar = $user->profile->avatar;
|
||||||
|
|
||||||
|
@ -90,7 +93,9 @@ class DeleteAccountPipeline implements ShouldQueue
|
||||||
Follower::whereProfileId($id)->orWhere('following_id', $id)->forceDelete();
|
Follower::whereProfileId($id)->orWhere('following_id', $id)->forceDelete();
|
||||||
|
|
||||||
Like::whereProfileId($id)->forceDelete();
|
Like::whereProfileId($id)->forceDelete();
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::transaction(function() use ($user) {
|
||||||
$medias = Media::whereUserId($user->id)->get();
|
$medias = Media::whereUserId($user->id)->get();
|
||||||
foreach($medias as $media) {
|
foreach($medias as $media) {
|
||||||
$path = $media->media_path;
|
$path = $media->media_path;
|
||||||
|
@ -103,31 +108,52 @@ class DeleteAccountPipeline implements ShouldQueue
|
||||||
}
|
}
|
||||||
$media->forceDelete();
|
$media->forceDelete();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::transaction(function() use ($user) {
|
||||||
Mention::whereProfileId($user->profile->id)->forceDelete();
|
Mention::whereProfileId($user->profile->id)->forceDelete();
|
||||||
|
Notification::whereProfileId($user->profile->id)->orWhere('actor_id', $user->profile->id)->forceDelete();
|
||||||
|
});
|
||||||
|
|
||||||
Notification::whereProfileId($id)->orWhere('actor_id', $id)->forceDelete();
|
DB::transaction(function() use ($user) {
|
||||||
|
|
||||||
Status::whereProfileId($user->profile->id)->forceDelete();
|
Status::whereProfileId($user->profile->id)->forceDelete();
|
||||||
|
|
||||||
Report::whereUserId($user->id)->forceDelete();
|
Report::whereUserId($user->id)->forceDelete();
|
||||||
$this->deleteProfile($user);
|
$this->deleteProfile($user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteProfile($user) {
|
protected function deleteProfile($user) {
|
||||||
DB::transaction(function() use ($user) {
|
DB::transaction(function() use ($user) {
|
||||||
Profile::whereUserId($user->id)->delete();
|
Profile::whereUserId($user->id)->delete();
|
||||||
$this->deleteUser($user);
|
$this->deleteUserSettings($user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteUser($user) {
|
protected function deleteUserSettings($user) {
|
||||||
|
|
||||||
DB::transaction(function() use ($user) {
|
DB::transaction(function() use ($user) {
|
||||||
|
UserDevice::whereUserId($user->id)->forceDelete();
|
||||||
UserFilter::whereUserId($user->id)->forceDelete();
|
UserFilter::whereUserId($user->id)->forceDelete();
|
||||||
UserSetting::whereUserId($user->id)->forceDelete();
|
UserSetting::whereUserId($user->id)->forceDelete();
|
||||||
$user->forceDelete();
|
$this->deleteUserColumns($user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function deleteUserColumns($user)
|
||||||
|
{
|
||||||
|
DB::transaction(function() use ($user) {
|
||||||
|
$user->status = 'deleted';
|
||||||
|
$user->name = 'deleted';
|
||||||
|
$user->email = $user->id;
|
||||||
|
$user->password = '';
|
||||||
|
$user->remember_token = null;
|
||||||
|
$user->is_admin = false;
|
||||||
|
$user->{'2fa_enabled'} = false;
|
||||||
|
$user->{'2fa_secret'} = null;
|
||||||
|
$user->{'2fa_backup_codes'} = null;
|
||||||
|
$user->{'2fa_setup_at'} = null;
|
||||||
|
$user->save();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue