Selaa lähdekoodia

self delete user, TOS

self delete user, TOS
Dennis 2 vuotta sitten
vanhempi
commit
3c210d388d

+ 2 - 0
app/Classes/Settings/System.php

@@ -48,6 +48,7 @@ public function checkPteroClientkey(){
             "enable-disable-servers" => "string",
             "show-imprint" => "string",
             "show-privacy" => "string",
+            "show-tos" => "string",
         ]);
 
         $validator->after(function ($validator) use ($request) {
@@ -91,6 +92,7 @@ public function checkPteroClientkey(){
             "SETTINGS::SYSTEM:CREATION_OF_NEW_USERS" => "enable-disable-new-users",
             "SETTINGS::SYSTEM:SHOW_IMPRINT" => "show-imprint",
             "SETTINGS::SYSTEM:SHOW_PRIVACY" => "show-privacy",
+            "SETTINGS::SYSTEM:SHOW_TOS" => "show-tos",
         ];
 
 

+ 12 - 0
app/Http/Controllers/ProfileController.php

@@ -39,6 +39,18 @@ class ProfileController extends Controller
         ]);
     }
 
+
+
+    public function selfDestroyUser(){
+
+            $user = Auth::user();
+            //if ($user->role == "admin") return back()->with("error", "You cannot delete yourself as an admin!");
+
+            $user->delete();
+            return redirect("/login")->with('success', __("Account permanently deleted!"));
+
+    }
+
     /** Update the specified resource in storage.
      * @param Request $request
      * @param int $id

+ 1 - 1
config/app.php

@@ -2,7 +2,7 @@
 
 return [
 
-    'version' => '0.8.3.2',
+    'version' => '0.8.4',
 
     /*
     |--------------------------------------------------------------------------

+ 13 - 0
resources/views/admin/settings/tabs/system.blade.php

@@ -13,6 +13,19 @@
                     </div>
                 </div>
                 <div class="form-group">
+                    <div class="custom-control mb-1 p-0">
+                        <div class="col m-0 p-0 d-flex justify-content-between align-items-center">
+                            <div>
+                                <input value="true" id="show-tos" name="show-tos"
+                                       {{ config('SETTINGS::SYSTEM:SHOW_TOS') == 'true' ? 'checked' : '' }}
+                                       type="checkbox">
+                                <label for="show-tos">{{ __('Show Terms of Service') }} </label>
+                            </div>
+                            <i data-toggle="popover" data-trigger="hover" data-html="true"
+                               data-content="{{ __('Show the TOS link in the footer of every page. <br> Edit the content in "resources/views/information/tos-content.blade.php"') }}"
+                               class="fas fa-info-circle"></i>
+                        </div>
+                    </div>
                     <div class="custom-control mb-1 p-0">
                         <div class="col m-0 p-0 d-flex justify-content-between align-items-center">
                             <div>

+ 3 - 0
resources/views/auth/login.blade.php

@@ -131,6 +131,9 @@
                 @if (config('SETTINGS::SYSTEM:SHOW_PRIVACY'))
                     <a href="{{ route('privacy') }}"><strong>{{ __('Privacy') }}</strong></a>
                 @endif
+                @if (config('SETTINGS::SYSTEM:SHOW_TOS'))
+                    | <a href="{{ route('tos') }}"><strong>{{ __('Terms of Service') }}</strong></a>
+                @endif
             </div>
         </div>
     </body>

+ 5 - 2
resources/views/auth/register.blade.php

@@ -171,10 +171,13 @@
         <div class="fixed-bottom ">
             <div class="container text-center">
                 @if (config('SETTINGS::SYSTEM:SHOW_IMPRINT'))
-                    <a href="{{ route('imprint') }}"><strong>{{ __('Imprint') }}</strong></a> |
+                    <a target="_blank" href="{{ route('imprint') }}"><strong>{{ __('Imprint') }}</strong></a> |
                 @endif
                 @if (config('SETTINGS::SYSTEM:SHOW_PRIVACY'))
-                    <a href="{{ route('privacy') }}"><strong>{{ __('Privacy') }}</strong></a>
+                    <a target="_blank" href="{{ route('privacy') }}"><strong>{{ __('Privacy') }}</strong></a>
+                @endif
+                @if (config('SETTINGS::SYSTEM:SHOW_TOS'))
+                    | <a target="_blank" href="{{ route('tos') }}"><strong>{{ __('Terms of Service') }}</strong></a>
                 @endif
             </div>
         </div>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 273 - 0
resources/views/information/tos-content.blade.php


+ 21 - 0
resources/views/information/tos.blade.php

@@ -0,0 +1,21 @@
+@extends('layouts.app')
+
+@section('content')
+
+    <body class="dark-mode">
+    <div class="container privacy-card">
+        <div class="row">
+            <div class="col-md-10" style="height: 20px;"></div>
+        </div>
+        <div class="row justify-content-center">
+            <div class="col-md-10">
+                <div class="card">
+                    <div class="card-header">{{ __('Terms of Service') }}</div>
+                    <div class="card-body">
+                        @include('information.tos-content')
+                    </div>
+                </div>
+            </div>
+        </div>
+    </body>
+@endsection

+ 5 - 2
resources/views/layouts/main.blade.php

@@ -429,11 +429,14 @@
             {{-- Show imprint and privacy link --}}
             <div class="float-right d-none d-sm-inline-block">
                 @if (config('SETTINGS::SYSTEM:SHOW_IMPRINT'))
-                    <a href="{{ route('imprint') }}"><strong>{{ __('Imprint') }}</strong></a> |
+                    <a target="_blank" href="{{ route('imprint') }}"><strong>{{ __('Imprint') }}</strong></a> |
                 @endif
                 @if (config('SETTINGS::SYSTEM:SHOW_PRIVACY'))
-                    <a href="{{ route('privacy') }}"><strong>{{ __('Privacy') }}</strong></a>
+                    <a target="_blank" href="{{ route('privacy') }}"><strong>{{ __('Privacy') }}</strong></a>
                 @endif
+                    @if (config('SETTINGS::SYSTEM:SHOW_TOS'))
+                       | <a target="_blank" href="{{ route('tos') }}"><strong>{{ __('Terms of Service') }}</strong></a>
+                    @endif
             </div>
         </footer>
 

+ 34 - 0
resources/views/profile/index.blade.php

@@ -123,6 +123,11 @@
                                             <div class="text-muted">
                                                 <small>{{ $user->created_at->isoFormat('LL') }}</small>
                                             </div>
+                                            <div class="text-muted">
+                                                <small>
+                                                            <button class="badge badge-danger" id="confirmDeleteButton" type="button">{{ __('Permanently delete my account') }}</button>
+                                                </small>
+                                            </div>
                                         </div>
                                     </div>
                                 </div>
@@ -307,6 +312,35 @@
         </section>
         <!-- END CONTENT -->
     <script>
+
+        document.getElementById("confirmDeleteButton").onclick=async ()=>{
+                const {value: enterConfirm} = await Swal.fire({
+                    input: 'text',
+                    inputLabel: '{{__("Are you sure you want to permanently delete your account and all of your servers?")}} \n Type "delete my account" in the Box below',
+                    inputPlaceholder: 'delete my account',
+                    showCancelButton: true
+                })
+                if (enterConfirm === "delete my account") {
+                    Swal.fire("{{__('Account has been destroyed')}}", '', 'error')
+                    $.ajax({
+                        type: "POST",
+                        url: "{{route("profile.selfDestroyUser")}}",
+                        data: `{
+                        "confirmed": "yes",
+                      }`,
+                        success: function (result) {
+                            console.log(result);
+                        },
+                        dataType: "json"
+                    });
+                    location.reload();
+
+                } else {
+                    Swal.fire("{{__('Account has not been destroyed')}}", '', 'info')
+
+                }
+
+            }
         function onClickCopy() {
             let textToCopy = document.getElementById('RefLink').innerText;
             if(navigator.clipboard) {

+ 3 - 0
resources/views/servers/create.blade.php

@@ -222,12 +222,14 @@
                                                 x-text="product.price + ' {{ CREDITS_DISPLAY_NAME }}'"></span>
                                         </div>
                                     </div>
+                                    <div x-data="{ buttonDisabled: false }">
                                     <button type="submit" x-model="selectedProduct" name="product"
                                         :disabled="product.minimum_credits > user.credits||product.doesNotFit == true"
                                         :class="product.minimum_credits > user.credits ? 'disabled' : ''"
                                         class="btn btn-primary btn-block mt-2" @click="setProduct(product.id)"
                                         x-text=" product.doesNotFit == true? '{{ __('Server can´t fit on this node') }}' : (product.minimum_credits > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
                                     </button>
+                                    </div>
                                 </div>
                             </div>
                     </div>
@@ -244,6 +246,7 @@
 
 
     <script>
+
         function serverApp() {
             return {
                 //loading

+ 18 - 20
routes/web.php

@@ -1,36 +1,36 @@
 <?php
 
+use App\Classes\Settings\Invoices;
+use App\Classes\Settings\Language;
 use App\Classes\Settings\Misc;
 use App\Classes\Settings\Payments;
+use App\Classes\Settings\System;
 use App\Http\Controllers\Admin\ActivityLogController;
 use App\Http\Controllers\Admin\ApplicationApiController;
 use App\Http\Controllers\Admin\InvoiceController;
 use App\Http\Controllers\Admin\OverViewController;
 use App\Http\Controllers\Admin\PaymentController;
-use App\Http\Controllers\Admin\ShopProductController;
 use App\Http\Controllers\Admin\ProductController;
 use App\Http\Controllers\Admin\ServerController as AdminServerController;
 use App\Http\Controllers\Admin\SettingsController;
+use App\Http\Controllers\Admin\ShopProductController;
 use App\Http\Controllers\Admin\UsefulLinkController;
 use App\Http\Controllers\Admin\UserController;
 use App\Http\Controllers\Admin\VoucherController;
-use App\Http\Controllers\Moderation\TicketsController as ModTicketsController;
 use App\Http\Controllers\Auth\SocialiteController;
 use App\Http\Controllers\HomeController;
+use App\Http\Controllers\Moderation\TicketsController as ModTicketsController;
 use App\Http\Controllers\NotificationController;
+use App\Http\Controllers\PartnerController;
 use App\Http\Controllers\ProductController as FrontProductController;
 use App\Http\Controllers\ProfileController;
 use App\Http\Controllers\ServerController;
 use App\Http\Controllers\StoreController;
-use App\Http\Controllers\TranslationController;
 use App\Http\Controllers\TicketsController;
+use App\Http\Controllers\TranslationController;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Route;
-use App\Classes\Settings\Language;
-use App\Classes\Settings\Invoices;
-use App\Classes\Settings\System;
-use App\Http\Controllers\PartnerController;
 
 /*
 |--------------------------------------------------------------------------
@@ -53,13 +53,9 @@ Auth::routes(['verify' => true]);
 # Stripe WebhookRoute -> validation in Route Handler
 Route::post('payment/StripeWebhooks', [PaymentController::class, 'StripeWebhooks'])->name('payment.StripeWebhooks');
 
-Route::get('/privacy', function () {
-    return view('information.privacy');
-})->name('privacy');
-Route::get('/imprint', function () {
-    return view('information.imprint');
-})->name('imprint');
-
+Route::get('/privacy', function () { return view('information.privacy');})->name('privacy');
+Route::get('/imprint', function () { return view('information.imprint');})->name('imprint');
+Route::get('/tos', function () { return view('information.tos');})->name('tos');
 
 Route::middleware(['auth', 'checkSuspended'])->group(function () {
     #resend verification email
@@ -70,12 +66,14 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
     })->middleware(['auth', 'throttle:3,1'])->name('verification.send');
 
     #normal routes
-    Route::get('notifications/readAll',[NotificationController::class,'readAll'])->name('notifications.readAll');
+    Route::get('notifications/readAll', [NotificationController::class, 'readAll'])->name('notifications.readAll');
     Route::resource('notifications', NotificationController::class);
     Route::resource('servers', ServerController::class);
-    if(config('SETTINGS::SYSTEM:ENABLE_UPGRADE')){
-        Route::post('servers/{server}/upgrade', [ServerController::class,'upgrade'])->name('servers.upgrade');
+    if (config('SETTINGS::SYSTEM:ENABLE_UPGRADE')) {
+        Route::post('servers/{server}/upgrade', [ServerController::class, 'upgrade'])->name('servers.upgrade');
     }
+
+    Route::post('profile/selfdestruct', [ProfileController::class, 'selfDestroyUser'])->name('profile.selfDestroyUser');
     Route::resource('profile', ProfileController::class);
     Route::resource('store', StoreController::class);
 
@@ -106,7 +104,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
     Route::post('changelocale', [TranslationController::class, 'changeLocale'])->name('changeLocale');
 
     #ticket user
-    if(config("SETTINGS::TICKET:ENABLED")) {
+    if (config("SETTINGS::TICKET:ENABLED")) {
         Route::get('ticket', [TicketsController::class, 'index'])->name('ticket.index');
         Route::get('ticket/datatable', [TicketsController::class, 'datatable'])->name('ticket.datatable');
         Route::get('ticket/new', [TicketsController::class, 'create'])->name('ticket.new');
@@ -172,7 +170,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
         Route::resource('settings', SettingsController::class)->only('index');
 
         #invoices
-        Route::get('invoices/download-invoices', [InvoiceController::class, 'downloadAllInvoices'])->name('invoices.downloadAllInvoices');;
+        Route::get('invoices/download-invoices', [InvoiceController::class, 'downloadAllInvoices'])->name('invoices.downloadAllInvoices');
         Route::get('invoices/download-single-invoice', [InvoiceController::class, 'downloadSingleInvoice'])->name('invoices.downloadSingleInvoice');
 
         #usefullinks
@@ -215,4 +213,4 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
     });
 
     Route::get('/home', [HomeController::class, 'index'])->name('home');
-});
+});

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä