add ability to delete accounts

This commit is contained in:
Thomas G 2023-03-07 13:49:28 +11:00
parent 74a062b7a3
commit b2e18f1556
8 changed files with 100 additions and 9 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
use App\Models\UserSetting;
class AccountController extends Controller
{
public function delete()
{
return view('dangerzone.delete');
}
public function deleteaccount()
{
$user = Auth::User();
Auth::logout();
$user->delete();
return view('index');
}
}
?>

View File

@ -0,0 +1,57 @@
@extends('layouts.app')
@section('title')
<title>Delete Account - {{ env('APP_NAME') }}</title>
@endsection
@section('titlediscord')
<meta content="Delete Account - {{ env('APP_NAME') }}" property="og:title" />
@endsection
@section('descdiscord')
<meta content="ARCHBLOX is a work in progress 2012 ROBLOX revival with a heavy emphasis on Skeuomorphic UI." property="og:description" />
@endsection
@section('content')
<div class="PageTitleBar">
<h1>Delete Account</h1>
</div>
<p class="important">
WARNING: BY DELETING YOUR ACCOUNT, YOU LOSE
<br />
<br />
@php echo Auth::user()->morbux; @endphp ARKOTs
<br />
@php echo Auth::user()->getFriendsCount() @endphp FRIENDS
<br />
{{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }} SENT MESSAGES
<br />
{{ App\Models\Message::where('user_id', Auth::id())->count() }} RECIEVED MESSAGES
<br />
{{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }} ARCHIVED MESSAGES
<br />
0 AVATAR ITEMS
<br />
0 ASSETS
<br />
0 Places
<br />
0 UNIVERSES
<br />
AND ANYTHING ELSE THAT IS LINKED TO YOUR ACCOUNT.
<br />
<br />
</p>
@if (App\Models\User::isAdmin())
<p>Sorry, since you are an Admin, you cannot delete your account through here. Ask a developer if you wish to delete your account.</p>
@else
<form method="POST" action="{{ route('deleteaccount') }}">
@csrf
<input style="width:5%;margin-bottom:15px;margin-top:15px" type="checkbox" name="remember" id="remember">
<label class="form-check-label" for="remember">
{{ __('I agree that clicking the button below will fully wipe my account from the servers, with no way to recover it later.') }}
</label>
<br />
<br />
<button onClick="this.form.submit();this.disabled=true" class="redbutton">Delete Account</button>
</form>
@endif
</div>
@endsection

View File

@ -24,7 +24,7 @@
@if ($message->deleted) @if ($message->deleted)
<button class="greenbutton" type="submit">Recover</button> <button class="greenbutton" type="submit">Recover</button>
@else @else
<button class="redbutton" type="submit">Delete</button> <button class="redbutton" type="submit">Archive</button>
@endif @endif
</form> </form>
@endif @endif

View File

@ -1,6 +1,6 @@
@extends('layouts.app') @extends('layouts.app')
@section('title') @section('title')
<title>Deleted Messages - {{ env('APP_NAME') }}</title> <title>Archived Messages - {{ env('APP_NAME') }}</title>
@endsection @endsection
@section('alert') @section('alert')
@ -22,7 +22,7 @@
({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }})</a> ({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }})</a>
<a href="{{ route('inbox_sent') }}" class="tab">Sent <a href="{{ route('inbox_sent') }}" class="tab">Sent
({{ App\Models\Message::where('user_id', Auth::id())->count() }})</a> ({{ App\Models\Message::where('user_id', Auth::id())->count() }})</a>
<a href="#" class="tab_selected">Deleted <a href="#" class="tab_selected">Archived
({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }})</a> ({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }})</a>
</div> </div>
</div> </div>

View File

@ -20,7 +20,7 @@
({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }})</a> ({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }})</a>
<a href="{{ route('inbox_sent') }}" class="tab">Sent <a href="{{ route('inbox_sent') }}" class="tab">Sent
({{ App\Models\Message::where('user_id', Auth::id())->count() }})</a> ({{ App\Models\Message::where('user_id', Auth::id())->count() }})</a>
<a href="{{ route('deleted') }}" class="tab">Deleted <a href="{{ route('deleted') }}" class="tab">Archived
({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }})</a> ({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }})</a>
</div> </div>
</div> </div>
@ -29,7 +29,7 @@
Message</a></button> Message</a></button>
<form action="{{ route('delete_all') }}" method="POST" style="display:inline-block"> <form action="{{ route('delete_all') }}" method="POST" style="display:inline-block">
@csrf @csrf
<button class="redbutton" type="submit">Delete All Messages</button> <button class="redbutton" type="submit">Archive All Messages</button>
</form> </form>
<br> <br>
<br> <br>

View File

@ -17,7 +17,7 @@
<a href="{{ route('inbox') }}" class="tab">Inbox <a href="{{ route('inbox') }}" class="tab">Inbox
({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }})</a> ({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', false)->count() }})</a>
<a href="#" class="tab_selected">Sent ({{ App\Models\Message::where('user_id', Auth::id())->count() }})</a> <a href="#" class="tab_selected">Sent ({{ App\Models\Message::where('user_id', Auth::id())->count() }})</a>
<a href="{{ route('deleted') }}" class="tab">Deleted <a href="{{ route('deleted') }}" class="tab">Archived
({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }})</a> ({{ App\Models\Message::where('sendto_id', Auth::id())->where('deleted', true)->count() }})</a>
</div> </div>
</div> </div>

View File

@ -212,8 +212,8 @@
<br> <br>
<div style="flex-wrap: wrap; flex-direction: column;"> <div style="flex-wrap: wrap; flex-direction: column;">
<h3>DANGER ZONE</h3> <h3>DANGER ZONE</h3>
<p style="warningtext">These are inactive for now.<br>In order to delete your account, please ask one of the <!--<p style="warningtext">These are inactive for now.<br>In order to delete your account, please ask one of the
Developers.</p> Developers.</p>-->
<p><button class="redbutton" disabled>Delete Account</button> <button class="redbutton" disabled>Disable Account</button></p> <p><a href="{{ route('delete') }}"> <button class="redbutton" >Delete Account</button></a> <button class="redbutton" disabled>Disable Account</button></p>
</div> </div>
@endsection @endsection

View File

@ -60,6 +60,10 @@ Route::middleware(['auth'])->group(function () {
Route::get('/my/invites', [App\Http\Controllers\KeyController::class, 'index'])->name('key_index'); Route::get('/my/invites', [App\Http\Controllers\KeyController::class, 'index'])->name('key_index');
Route::post('/my/invites', [App\Http\Controllers\KeyController::class, 'create'])->name('key_create'); Route::post('/my/invites', [App\Http\Controllers\KeyController::class, 'create'])->name('key_create');
// Account Management routes
Route::get('/deleteaccount', [App\Http\Controllers\AccountController::class, 'delete'])->name('delete');
Route::post('/deleteaccountrequestbyebye', [App\Http\Controllers\AccountController::class, 'deleteaccount'])->name('deleteaccount');
// Friendship system routes // Friendship system routes
Route::get('/my/friends', [App\Http\Controllers\FriendController::class, 'friends'])->name('friends'); Route::get('/my/friends', [App\Http\Controllers\FriendController::class, 'friends'])->name('friends');