File tree Expand file tree Collapse file tree
app/Http/Controllers/Auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ APP_URL=http://localhost:8000
3030# Can be true or false. Default to false.
3131APP_DISABLE_SIGNUP = false
3232
33+ # Show a notice on the login page warning that this instance and all its data
34+ # will be deleted. Only meant for the hosted instance. Default to false.
35+ APP_SHOW_DELETION_NOTICE = false
36+
3337# Database to store information
3438# The documentation is here: https://laravel.com/docs/10.x/database
3539# You can also see the different values you can use in config/database.php
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ public function __invoke(Request $request): Response
4343 'wallpaperUrl ' => WallpaperHelper::getRandomWallpaper (),
4444 'providers ' => $ providers ,
4545 'beta ' => $ request ->cookie ('beta ' ) !== 'false ' ,
46+ 'showDeletionNotice ' => (bool ) config ('monica.show_deletion_notice ' ),
4647 ]);
4748 }
4849
Original file line number Diff line number Diff line change 2323 */
2424 'disable_signup ' => (bool ) env ('APP_DISABLE_SIGNUP ' , false ),
2525
26+ /*
27+ |--------------------------------------------------------------------------
28+ | Show instance deletion notice
29+ |--------------------------------------------------------------------------
30+ |
31+ | Displays a notice on the login page warning users that this instance
32+ | and all its data will be deleted. Meant for the hosted instance only.
33+ |
34+ */
35+ 'show_deletion_notice ' => (bool ) env ('APP_SHOW_DELETION_NOTICE ' , false ),
36+
2637 /*
2738 |--------------------------------------------------------------------------
2839 | Commit hash of the application
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const props = defineProps({
2323 userless: Boolean ,
2424 autologin: Boolean ,
2525 beta: Boolean ,
26+ showDeletionNotice: Boolean ,
2627});
2728const webauthn = ref (false );
2829const publicKeyRef = ref (null );
@@ -89,6 +90,7 @@ const useWebauthn = () => {
8990 </h1 >
9091
9192 <div
93+ v-if =" showDeletionNotice"
9294 role =" alert"
9395 class =" mt-6 flex w-full items-start gap-3 border border-amber-200 bg-amber-50 px-6 py-4 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100 rounded-lg sm:max-w-4xl" >
9496 <TriangleAlert class="h-5 w-5 shrink-0 text-amber-600 dark:text-amber-400 " aria-hidden="true" />
Original file line number Diff line number Diff line change 44
55use App \Models \User ;
66use Illuminate \Foundation \Testing \DatabaseTransactions ;
7+ use Inertia \Testing \AssertableInertia as Assert ;
78use PHPUnit \Framework \Attributes \Test ;
89use Tests \TestCase ;
910
@@ -21,6 +22,31 @@ public function login_screen_can_be_rendered()
2122 $ response ->assertStatus (200 );
2223 }
2324
25+ #[Test]
26+ public function deletion_notice_is_hidden_by_default ()
27+ {
28+ $ this ->withoutVite ();
29+
30+ $ this ->get ('/login ' )
31+ ->assertInertia (fn (Assert $ page ) => $ page
32+ ->component ('Auth/Login ' , false )
33+ ->where ('showDeletionNotice ' , false )
34+ );
35+ }
36+
37+ #[Test]
38+ public function deletion_notice_is_shown_when_enabled ()
39+ {
40+ $ this ->withoutVite ();
41+ config (['monica.show_deletion_notice ' => true ]);
42+
43+ $ this ->get ('/login ' )
44+ ->assertInertia (fn (Assert $ page ) => $ page
45+ ->component ('Auth/Login ' , false )
46+ ->where ('showDeletionNotice ' , true )
47+ );
48+ }
49+
2450 #[Test]
2551 public function users_can_authenticate_using_the_login_screen ()
2652 {
You can’t perform that action at this time.
0 commit comments