From 3f4bc28fd47888e9e6440d094b0da49ab61e6b1f Mon Sep 17 00:00:00 2001 From: Miguel N Date: Sat, 4 Sep 2021 00:44:54 +0100 Subject: [PATCH] Added Demo mode Demo mode allows to safely run a demo version of the app, with destructive features limited. Some bugs were also fixed in this commit. --- ..env.swp | Bin 0 -> 1024 bytes .env.example | 4 ++ app/ApiKey.php | 2 +- app/CustomFacades/IP.php | 19 +++--- .../Controllers/ApplicationController.php | 15 ++++- .../Controllers/Auth/RegisterController.php | 6 +- app/Http/Controllers/BanController.php | 12 ++++ app/Http/Controllers/DashboardController.php | 16 ++++- app/Http/Controllers/FormController.php | 11 +++- app/Http/Controllers/TeamFileController.php | 14 +++++ app/Http/Controllers/UserController.php | 34 +++++++++++ app/Providers/AppServiceProvider.php | 3 + app/Services/ApplicationService.php | 2 +- app/Services/AppointmentService.php | 7 +-- app/Services/DemoService.php | 11 ++++ app/Services/SecuritySettingsService.php | 2 +- app/Traits/ReceivesAccountTokens.php | 14 +++++ config/demo.php | 7 +++ database/seeders/UserSeeder.php | 46 +++++++++++--- resources/views/auth/login.blade.php | 16 +++++ resources/views/auth/register.blade.php | 19 ++++-- .../administration/formbuilder.blade.php | 6 ++ resources/views/dashboard/dashboard.blade.php | 41 ++++++++++++- .../dashboard/teams/team-files.blade.php | 57 +++++++++++------- .../user/profile/displayprofile.blade.php | 44 +++++++++++--- .../user/profile/useraccount.blade.php | 37 ++++++++++-- .../views/dashboard/user/viewapp.blade.php | 4 +- resources/views/home.blade.php | 13 ++++ routes/web.php | 6 +- 29 files changed, 385 insertions(+), 83 deletions(-) create mode 100644 ..env.swp create mode 100644 app/Services/DemoService.php create mode 100644 config/demo.php diff --git a/..env.swp b/..env.swp new file mode 100644 index 0000000000000000000000000000000000000000..61ad66a963a236ab58210737e1dd2c9bec82ab94 GIT binary patch literal 1024 zcmYc?$V<%2S1{ExVL$;Pz6=bxndzmeIVPrNC^DEFh`Io0-O{AeypmE(1yB*a)VwmB SlA{u%Aut*Ov<`t#bPE87y$)*t literal 0 HcmV?d00001 diff --git a/.env.example b/.env.example index a3e03b9..42df9d6 100755 --- a/.env.example +++ b/.env.example @@ -11,6 +11,10 @@ APP_SITEHOMEPAGE="" # Void if env is production. NONPROD_FORCE_SECURE=false +# Disables certain features for security purposes while running an open authentication system +# Enable only for demonostration purposes +DEMO_MODE=false + LOG_CHANNEL=daily DB_CONNECTION=mysql diff --git a/app/ApiKey.php b/app/ApiKey.php index 6a97f85..0ed33ff 100644 --- a/app/ApiKey.php +++ b/app/ApiKey.php @@ -20,6 +20,6 @@ class ApiKey extends Model public function user() { - return $this->belongsTo('App\User', 'id'); + return $this->belongsTo('App\User', 'owner_user_id', 'id'); } } diff --git a/app/CustomFacades/IP.php b/app/CustomFacades/IP.php index 230ec83..6753e29 100755 --- a/app/CustomFacades/IP.php +++ b/app/CustomFacades/IP.php @@ -38,13 +38,18 @@ class IP 'ip' => $IP, ]; - // TODO: Maybe unwrap this? Methods are chained here - return json_decode(Cache::remember($IP, 3600, function () use ($IP) { - return Http::get(config('general.urls.ipapi.ipcheck'), [ - 'apiKey' => config('general.keys.ipapi.apikey'), - 'ip' => $IP, - ])->body(); - })); + if (!config('demo.is_enabled')) { + return json_decode(Cache::remember($IP, 3600, function () use ($IP) { + return Http::get(config('general.urls.ipapi.ipcheck'), [ + 'apiKey' => config('general.keys.ipapi.apikey'), + 'ip' => $IP, + ])->body(); + })); + } + + return new class { + public $message = "This feature is disabled."; + }; } } diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index e137503..fcb6dbf 100755 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -22,6 +22,7 @@ namespace App\Http\Controllers; use App\Application; +use App\Exceptions\ApplicationNotFoundException; use App\Exceptions\IncompleteApplicationException; use App\Exceptions\UnavailableApplicationException; use App\Exceptions\VacancyNotFoundException; @@ -74,14 +75,22 @@ class ApplicationController extends Controller { $this->authorize('viewAny', Application::class); - return view('dashboard.appmanagement.all'); + return view('dashboard.appmanagement.all') + ->with('applications', Application::all()); } public function renderApplicationForm($vacancySlug) { - return $this->applicationService->renderForm($vacancySlug); + try { + return $this->applicationService->renderForm($vacancySlug); + } + catch (ApplicationNotFoundException $ex) { + return redirect() + ->back() + ->with('error', $ex->getMessage()); + } } public function saveApplicationAnswers(Request $request, $vacancySlug) @@ -98,7 +107,7 @@ class ApplicationController extends Controller } return redirect() - ->back() + ->to(route('showUserApps')) ->with('success', __('Thank you! Your application has been processed and our team will get to it shortly.')); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 41af9f2..3140223 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -92,7 +92,7 @@ class RegisterController extends Controller case 'low': $password = ['required', 'string', 'min:10', 'confirmed']; break; - + case 'medium': $password = ['required', 'string', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[#?!@$%^&*-]).{12,}$/']; break; @@ -124,11 +124,11 @@ class RegisterController extends Controller 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), - 'originalIP' => request()->ip(), + 'originalIP' => config('demo.is_enabled') ? '0.0.0.0' : request()->ip(), ]); // It's not the registration controller's concern to create a profile for the user, - // so this code has been moved to it's respective observer, following the separation of concerns pattern. + // so this code has been moved to its respective observer, following the separation of concerns pattern. $user->assignRole('user'); diff --git a/app/Http/Controllers/BanController.php b/app/Http/Controllers/BanController.php index 3818388..97075d3 100755 --- a/app/Http/Controllers/BanController.php +++ b/app/Http/Controllers/BanController.php @@ -42,6 +42,12 @@ class BanController extends Controller public function insert(BanUserRequest $request, User $user) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + $this->authorize('create', [Ban::class, $user]); @@ -60,6 +66,12 @@ class BanController extends Controller public function delete(Request $request, User $user) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + $this->authorize('delete', $user->bans); if ($this->suspensionService->isSuspended($user)) { diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index df46bd2..cb946e1 100755 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -24,6 +24,7 @@ namespace App\Http\Controllers; use App\Application; use App\User; use App\Vacancy; +use Illuminate\Support\Facades\Auth; class DashboardController extends Controller { @@ -34,14 +35,27 @@ class DashboardController extends Controller $totalPeerReview = Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get()->count(); $totalNewApplications = Application::where('applicationStatus', 'STAGE_SUBMITTED')->get()->count(); $totalDenied = Application::where('applicationStatus', 'DENIED')->get()->count(); + $vacancies = Vacancy::where('vacancyStatus', '<>', 'CLOSED')->get(); + + $totalDeniedSingle = Application::where([ + ['applicationStatus', '=', 'DENIED'], + ['applicantUserID', '=', Auth::user()->id] + ])->get(); + + $totalNewSingle = Application::where([ + ['applicationStatus', '=', 'STAGE_SUBMITTED'], + ['applicantUserID', '=', Auth::user()->id] + ])->get(); return view('dashboard.dashboard') ->with([ - 'vacancies' => Vacancy::all(), + 'vacancies' => $vacancies, 'totalUserCount' => User::all()->count(), 'totalDenied' => $totalDenied, 'totalPeerReview' => $totalPeerReview, 'totalNewApplications' => $totalNewApplications, + 'totalNewSingle' => $totalNewSingle->count(), + 'totalDeniedSingle' => $totalDeniedSingle->count() ]); } } diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 82848fe..366475f 100755 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -21,6 +21,7 @@ namespace App\Http\Controllers; +use App\Exceptions\EmptyFormException; use App\Exceptions\FormHasConstraintsException; use App\Form; use App\Services\FormManagementService; @@ -53,7 +54,15 @@ class FormController extends Controller public function saveForm(Request $request) { - $form = $this->formService->addForm($request->all()); + try { + $form = $this->formService->addForm($request->all()); + } + catch (EmptyFormException $ex) + { + return redirect() + ->back() + ->with('exception', $ex->getMessage()); + } // Form is boolean or array if ($form) diff --git a/app/Http/Controllers/TeamFileController.php b/app/Http/Controllers/TeamFileController.php index b6fbdc6..30c5994 100755 --- a/app/Http/Controllers/TeamFileController.php +++ b/app/Http/Controllers/TeamFileController.php @@ -62,6 +62,13 @@ class TeamFileController extends Controller { $this->authorize('store', TeamFile::class); + if (config('demo.is_enabled')) + { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + try { $caption = $request->caption; $description = $request->description; @@ -110,6 +117,13 @@ class TeamFileController extends Controller { $this->authorize('delete', $teamFile); + if (config('demo.is_enabled')) + { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + try { Storage::delete($teamFile->fs_location); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 0bba54a..2f0d2f4 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -32,6 +32,7 @@ use App\Http\Requests\SearchPlayerRequest; use App\Http\Requests\UpdateUserRequest; use App\Notifications\ChangedPassword; use App\Notifications\EmailChanged; +use App\Traits\DisablesFeatures; use App\Traits\ReceivesAccountTokens; use App\User; use Google2FA; @@ -168,6 +169,11 @@ class UserController extends Controller public function changePassword(ChangePasswordRequest $request) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } $user = User::find(Auth::user()->id); if (! is_null($user)) { @@ -191,6 +197,12 @@ class UserController extends Controller public function changeEmail(ChangeEmailRequest $request) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + $user = User::find(Auth::user()->id); if (! is_null($user)) { @@ -214,6 +226,12 @@ class UserController extends Controller public function delete(DeleteUserRequest $request, User $user) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + $this->authorize('delete', $user); if ($request->confirmPrompt == 'DELETE ACCOUNT') { @@ -228,6 +246,11 @@ class UserController extends Controller public function update(UpdateUserRequest $request, User $user) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } $this->authorize('adminEdit', $user); // Mass update would not be possible here without extra code, making route model binding useless @@ -262,6 +285,12 @@ class UserController extends Controller public function add2FASecret(Add2FASecretRequest $request) { + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + $currentSecret = $request->session()->get('current2FA'); $isValid = Google2FA::verifyKey($currentSecret, $request->otp); @@ -314,6 +343,11 @@ class UserController extends Controller public function terminate(Request $request, User $user) { $this->authorize('terminate', User::class); + if (config('demo.is_enabled')) { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } // TODO: move logic to policy if (! $user->isStaffMember() || $user->is(Auth::user())) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4b35693..2deea95 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -27,6 +27,7 @@ use App\Observers\UserObserver; use App\User; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Schema; +use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use Sentry; @@ -67,5 +68,7 @@ class AppServiceProvider extends ServiceProvider $https = true; $this->app['request']->server->set('HTTPS', $https); + + View::share('demoActive', config('demo.is_enabled')); } } diff --git a/app/Services/ApplicationService.php b/app/Services/ApplicationService.php index f7defa6..a98da16 100644 --- a/app/Services/ApplicationService.php +++ b/app/Services/ApplicationService.php @@ -47,7 +47,7 @@ class ApplicationService * @throws VacancyNotFoundException Thrown when the associated vacancy is not found * @throws IncompleteApplicationException Thrown when there are missing fields */ - public function fillForm(Authenticatable $applicant, array $formData, $vacancySlug): bool + public function fillForm(User $applicant, array $formData, $vacancySlug): bool { $vacancy = Vacancy::with('forms')->where('vacancySlug', $vacancySlug)->get(); diff --git a/app/Services/AppointmentService.php b/app/Services/AppointmentService.php index 35f6de3..c00c666 100644 --- a/app/Services/AppointmentService.php +++ b/app/Services/AppointmentService.php @@ -56,12 +56,7 @@ class AppointmentService */ public function updateAppointment(Application $application, $status, $updateApplication = true) { - $validStatuses = [ - 'SCHEDULED', - 'CONCLUDED', - ]; - - if ($status == 'SCHEDULED' || $status == 'CONCLUDED') + if ($status == 'SCHEDULED' || $status == 'concluded') { $application->appointment->appointmentStatus = strtoupper($status); $application->appointment->save(); diff --git a/app/Services/DemoService.php b/app/Services/DemoService.php new file mode 100644 index 0000000..969de1d --- /dev/null +++ b/app/Services/DemoService.php @@ -0,0 +1,11 @@ +back() + ->with('error', 'This feature is disabled'); + } + // a little verbose $user = User::find(Auth::user()->id); $tokens = $user->generateAccountTokens(); @@ -49,6 +56,13 @@ trait ReceivesAccountTokens public function processDeleteConfirmation(Request $request, $ID, $action, $token) { + if (config('demo.is_enabled')) + { + return redirect() + ->back() + ->with('error', 'This feature is disabled'); + } + // We can't rely on Laravel's route model injection, because it'll ignore soft-deleted models, // so we have to use a special scope to find them ourselves. $user = User::withTrashed()->findOrFail($ID); diff --git a/config/demo.php b/config/demo.php new file mode 100644 index 0000000..a9824c3 --- /dev/null +++ b/config/demo.php @@ -0,0 +1,7 @@ + env('DEMO_MODE', false) + +]; diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 4c2ed3a..05963d1 100755 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -35,32 +35,34 @@ class UserSeeder extends Seeder */ public function run() { - + /** * Rationale: * A ghost account is an account used by deleted users. * Essentially, when users are deleted, their content is re-assigned to the * ghost account. - * Also used by one-off apps. - * + * Also used by one-off apps. + * * The ghost account was inspired by Github's ghost account. */ $ghostAccount = User::create([ - 'uuid' => '069a79f444e94726a5befca90e38aaf5', // Notch + 'uuid' => 'b741345057274a519144881927be0290', // Ghost 'name' => 'Ghost (deleted account)', - 'email' => 'blackhole@spacejewel-hosting.com', + 'email' => 'blackhole@example.com', + 'email_verified_at' => now(), 'username' => 'ghost', 'originalIP' => '0.0.0.0', - 'password' => 'locked' + 'password' => 'locked' ])->assignRole('user'); // There can't be role-less users $admin = User::create([ - 'uuid' => '6102256abd284dd7b68e4c96ef313734', + 'uuid' => '069a79f444e94726a5befca90e38aaf5', // Notch 'name' => 'Admin', 'email' => 'admin@example.com', + 'email_verified_at' => now(), 'username' => 'admin', - 'originalIP' => '217.1.189.34', + 'originalIP' => '0.0.0.0', 'password' => Hash::make('password'), ])->assignRole([ // all privileges @@ -68,7 +70,33 @@ class UserSeeder extends Seeder 'reviewer', 'admin', 'hiringManager', - 'developer' + ]); + + $staffmember = User::create([ + 'uuid' => '853c80ef3c3749fdaa49938b674adae6', // Jeb__ + 'name' => 'Staff Member', + 'email' => 'staffmember@example.com', + 'email_verified_at' => now(), + 'username' => 'staffmember', + 'originalIP' => '0.0.0.0', + 'password' => Hash::make('password'), + + ])->assignRole([ // all privileges + 'user', + 'reviewer', + ]); + + $user = User::create([ + 'uuid' => 'f7c77d999f154a66a87dc4a51ef30d19', // hypixel + 'name' => 'End User', + 'email' => 'enduser@example.com', + 'email_verified_at' => now(), + 'username' => 'enduser', + 'originalIP' => '0.0.0.0', + 'password' => Hash::make('password'), + + ])->assignRole([ // all privileges + 'user', ]); } diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 2b31cf0..aa66135 100755 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -16,6 +16,22 @@

{{__('messages.signin_cta')}}

@csrf + @if ($demoActive) +
+

{{__('Warning')}}

+

{{ __('Do not use real credentials; The application is in demo mode.') }}

+ +

{{ __('Demo accounts:') }}

+
    +
  • admin@example.com
  • +
  • staffmember@example.com
  • +
  • enduser@example.com
  • +
+

{{ __('The password is ":password" for all accounts.', ['password' => 'password']) }}

+ +
+ @endif +
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index f04ad44..6f24f2f 100755 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -14,7 +14,7 @@ {{ config('adminlte.logo') }}
- + @if(\App\Facades\Options::getOption('pw_security_policy') !== 'off')
@@ -25,7 +25,7 @@

{{__('messages.pwsec.line3')}}

    @switch(\App\Facades\Options::getOption('pw_security_policy')) - + @case('low')
  • A minimum of 10 characters
  • @break @@ -34,14 +34,14 @@
  • A minimum of 12 characters;
  • At least one special character;
  • Lower case and upper case characters
  • - @break + @break @case('high')
  • A minimum of 20 characters;
  • At least one special character;
  • Lower case and upper case characters
  • At least one numerical character
  • - @break + @break @endswitch
@@ -49,6 +49,15 @@ @endif + @if($demoActive) +
+

{{ __('Warning') }}

+

{{ __('Do not use real credentials here. The application is in demo mode. Additionally, the database is wiped every six hours.') }}

+ +

{{ __('Also note: If a game license is required to sign up, you may find valid MC usernames at NameMC') }}

+
+ @endif + @csrf
@@ -68,7 +77,7 @@
- + @if(\App\Facades\Options::getOption('requireGameLicense') && \App\Facades\Options::getOption('currentGame') == 'MINECRAFT')
diff --git a/resources/views/dashboard/administration/formbuilder.blade.php b/resources/views/dashboard/administration/formbuilder.blade.php index e808c1a..9ea87a3 100755 --- a/resources/views/dashboard/administration/formbuilder.blade.php +++ b/resources/views/dashboard/administration/formbuilder.blade.php @@ -34,6 +34,12 @@ @endif + @if(session()->has('exception')) + + @endif + @stop @section('content') diff --git a/resources/views/dashboard/dashboard.blade.php b/resources/views/dashboard/dashboard.blade.php index 0087fc3..c777ca0 100755 --- a/resources/views/dashboard/dashboard.blade.php +++ b/resources/views/dashboard/dashboard.blade.php @@ -9,11 +9,46 @@ @section('js') + @endsection @section('content') + @if ($demoActive) + +
+

{{__('Reminder')}}

+

{{__('The application is in demo mode.')}}

+

{{ __('Demo mode disables some app features in order to preserve it\'s integrity for everyone who wants to test it. Here\'s what\'s disabled: ') }}

+
    +
  • {{ __('All user account operations such as: ') }} +
      +
    • {{ __('Password change') }}
    • +
    • {{ __('Two factor authentication') }}
    • +
    • {{ __('Email change') }}
    • +
    • {{ __('Account deletion') }}
    • +
    +
  • +
  • {{ __('Administrative actions such as:') }} +
      +
    • {{__('Account suspension')}}
    • +
    • {{ __('Termination') }}
    • +
    • {{ __('Account deletion') }}
    • +
    • {{ __('Privilege editing') }}
    • +
    +
  • +
  • {{ __('Team file uploads') }}
  • +
  • {{__('Developer mode')}}
  • +
  • {{ __('Admin logs') }}
  • +
+

To keep everyone safe, IP addresses are censored everywhere in the app, and they're also not collected during registration. The IP address lookup feature is also disabled.

+

Only system administrators can disable demo mode - it cannot be disabled via app settings.

+

Note! The database is wiped every six hours during demo mode.

+
+ + @endif + @if (!$vacancies->isEmpty()) @foreach($vacancies as $vacancy) @@ -80,7 +115,7 @@
-

{{ $openApplications ?? 0 }}

+

{{ $totalNewSingle ?? 0 }}

{{__('messages.ongoing_apps')}}

@@ -95,7 +130,7 @@
-

{{ $deniedApplications ?? 0 }}

+

{{ $totalDeniedSingle ?? 0 }}

{{__('messages.denied_apps')}}

@@ -190,7 +225,7 @@ @endif - @if ($isEligibleForApplication && !Auth::user()->isStaffMember()) + @if (!$vacancies->isEmpty() && $isEligibleForApplication && !Auth::user()->isStaffMember())
diff --git a/resources/views/dashboard/teams/team-files.blade.php b/resources/views/dashboard/teams/team-files.blade.php index 049490e..b248922 100755 --- a/resources/views/dashboard/teams/team-files.blade.php +++ b/resources/views/dashboard/teams/team-files.blade.php @@ -13,43 +13,56 @@ @section('content') - + @if(!$demoActive) + - - @csrf -
+ + @csrf +
- - + + - - + + -
+
- - + + - + - - - -
+ + + +
+ @endif
-
+
Team files illustration
+ @if($demoActive) +
+
+
+

Warning

+

Since many users may use the app at any given time, file uploads are disabled whilst demo mode is on.

+
+
+
+ @endif +
@@ -119,7 +132,7 @@
diff --git a/resources/views/dashboard/user/profile/displayprofile.blade.php b/resources/views/dashboard/user/profile/displayprofile.blade.php index 2d796a9..71dffed 100755 --- a/resources/views/dashboard/user/profile/displayprofile.blade.php +++ b/resources/views/dashboard/user/profile/displayprofile.blade.php @@ -43,6 +43,12 @@
@csrf + @if($demoActive) +
+

This feature is disabled

+
+ @endif +
@@ -69,7 +75,7 @@ - + @@ -77,6 +83,12 @@ @if (!Auth::user()->is($profile->user) && $profile->user->isStaffMember()) + @if($demoActive) +
+

This feature is disabled

+
+ @endif +

{{__('messages.profile.terminate_notice')}}

{{__('messages.profile.terminate_notice_warning')}} @@ -91,7 +103,7 @@

@csrf @method('PATCH') - +
@@ -102,6 +114,12 @@ + @if($demoActive) +
+

This feature is disabled

+
+ @endif +

{{__('messages.profile.delete_acc_warn')}}

{{__('messages.profile.delete_acc_consequence')}}

@@ -118,12 +136,12 @@ - +
- +

{{__('messages.profile.search_result')}}

@@ -209,18 +227,24 @@ + @if($demoActive) +
+

This feature is disabled

+
+ @endif +
@csrf @method('PATCH') - + - + - +

{{__('messages.profile.edituser_consequence')}}

@@ -233,7 +257,7 @@ @foreach($roles as $roleName => $status) - + {{ ucfirst($roleName) }} @@ -250,7 +274,7 @@ - + @@ -293,7 +317,7 @@

{{$profile->profileShortBio}}

{{__('messages.reusable.member_since', ['date' => $since])}}

@if (Auth::user()->hasRole('admin')) - + @endif @if ($profile->user->is(Auth::user())) diff --git a/resources/views/dashboard/user/profile/useraccount.blade.php b/resources/views/dashboard/user/profile/useraccount.blade.php index b05dde1..bf57e06 100755 --- a/resources/views/dashboard/user/profile/useraccount.blade.php +++ b/resources/views/dashboard/user/profile/useraccount.blade.php @@ -22,6 +22,14 @@ + @if ($demoActive) + +
+

This feature is disabled

+
+ + @endif +

Deleting your account is an irreversible process. The following data will be deleted (including personally identifiable data):

  • Last IP address
  • @@ -66,7 +74,7 @@ - + @@ -74,10 +82,16 @@ @if (!Auth::user()->has2FA()) - + + @if($demoActive) +
    +

    This feature is disabled

    +
    + @endif +

    {{__('messages.profile.2fa_welcome')}}

    {{__('messages.profile.supported_apps')}}

    @@ -118,7 +132,7 @@ - + @@ -248,6 +262,12 @@
    + @if($demoActive) +
    +

    This feature is disabled

    +
    + @endif +
    {{__('messages.profile.change_password')}}

    {{__('messages.profile.change_password_exp')}}

    @@ -271,7 +291,7 @@ - +
    {{__('messages.profile.2fa')}}
    @@ -289,10 +309,15 @@
    {{__('messages.profile.session_manager')}}

    {{__('messages.profile.terminate_others')}}

    -

    {{__('messages.profile.current_session', ['ipAddress' => $ip])}}

    +

    {{__('messages.profile.current_session', ['ipAddress' => ($demoActive) ? '0.0.0.0 (censored)' : $ip])}}

    + @if($demoActive) +
    +

    This feature is disabled

    +
    + @endif
    {{__('messages.profile.contact_settings')}}

    {{__('messages.profile.personal_data_change')}}

    @@ -320,7 +345,7 @@
    - +
    diff --git a/resources/views/dashboard/user/viewapp.blade.php b/resources/views/dashboard/user/viewapp.blade.php index d1205e2..f530a3a 100755 --- a/resources/views/dashboard/user/viewapp.blade.php +++ b/resources/views/dashboard/user/viewapp.blade.php @@ -103,7 +103,7 @@
    {{$content['title']}}
    - +

    {!! GrahamCampbell\Markdown\Facades\Markdown::convertToHtml($content['response']) !!}

    @@ -132,7 +132,7 @@

    {{__('messages.application_m.applicant_name')}} {{$application->user->name}}

    @if (Auth::user()->hasRole('hiringManager')) -

    {{__('messages.view_app.appl_ip')}} {{$application->user->originalIP}}

    +

    {{__('messages.view_app.appl_ip')}} {{ ($demoActive) ? '0.0.0.0 (censored)' : $application->user->originalIP }}

    @endif

    {{__('messages.application_m.application_date')}} {{$application->created_at}}

    {{__('messages.last_updated')}}{{$application->updated_at}}

    diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 472bf8d..8d68ead 100755 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -41,6 +41,19 @@
    + @if ($demoActive) +
    +
    +
    +

    Attention

    +

    Demo mode is active on this instance. The database is refreshed daily and some features are disabled for security reasons.

    + +

    If you're seeing this message in error, please contact your system administrator.

    +
    +
    +
    + @endif +
    diff --git a/routes/web.php b/routes/web.php index eb201ce..8630f9e 100755 --- a/routes/web.php +++ b/routes/web.php @@ -53,7 +53,9 @@ use Mcamara\LaravelLocalization\Facades\LaravelLocalization; */ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']], function () { Route::group(['prefix' => 'auth', 'middleware' => ['usernameUUID']], function () { - Auth::routes(['verify' => true]); + Auth::routes([ + 'verify' => true + ]); Route::post('/twofa/authenticate', [TwofaController::class, 'verify2FA']) ->name('verify2FA'); @@ -271,7 +273,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo Route::delete('forms/destroy/{form}', [FormController::class, 'destroy']) ->name('destroyForm'); - + Route::get('forms', [FormController::class, 'index']) ->name('showForms');