Skip to content

Commit b13f742

Browse files
Move CDash config definitions to cdash.php (#3473)
This PR moves the `user_registration_form_enabled` configuration option to `cdash.php` instead of Laravel's `auth.php`, keeping all of the custom CDash options in a single place.
1 parent 6ffba1b commit b13f742

6 files changed

Lines changed: 8 additions & 9 deletions

File tree

app/Http/Controllers/Auth/RegisterController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct()
4848

4949
public function showRegistrationForm(Request $request): View
5050
{
51-
if (config('auth.user_registration_form_enabled') === false) {
51+
if (config('cdash.user_registration_form_enabled') === false) {
5252
abort(404, 'Registration via form is disabled');
5353
}
5454
// We can route a user here with our form pre-populated
@@ -117,7 +117,7 @@ protected function registered(Request $request, $user)
117117
*/
118118
public function register(Request $request): Response|RedirectResponse
119119
{
120-
if (config('auth.user_registration_form_enabled') === false) {
120+
if (config('cdash.user_registration_form_enabled') === false) {
121121
return response('Registration via form is disabled', 404);
122122
}
123123
try {

config/auth.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
use App\Models\User;
55

66
return [
7-
// Whether or not "normal" username+password authentication is enabled
8-
'user_registration_form_enabled' => env('USER_REGISTRATION_FORM_ENABLED', true),
9-
107
/*
118
|--------------------------------------------------------------------------
129
| Authentication Defaults

config/cdash.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
'project_admin_registration_form_enabled' => env('PROJECT_ADMIN_REGISTRATION_FORM_ENABLED', true),
7070
// Text displayed at the top of all pages. Accepts inline markdown (links, bold, italics).
7171
'global_banner' => env('GLOBAL_BANNER'),
72+
// Whether or not new CDash users can register email+password accounts
73+
'user_registration_form_enabled' => env('USER_REGISTRATION_FORM_ENABLED', true),
7274
// Whether or not "normal" username+password authentication is enabled
7375
'username_password_authentication_enabled' => env('USERNAME_PASSWORD_AUTHENTICATION_ENABLED', true),
7476
'ldap_enabled' => env('CDASH_AUTHENTICATION_PROVIDER') === 'ldap',

resources/views/components/header.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
$logoid = $project->ImageId;
88
}
99
10-
$hideRegistration = config('auth.user_registration_form_enabled') === false;
10+
$hideRegistration = config('cdash.user_registration_form_enabled') === false;
1111
1212
$currentDateString = now()->toDateString();
1313

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
$routeList = ['verify' => true];
2929

30-
if (config('auth.user_registration_form_enabled') === false) {
30+
if (config('cdash.user_registration_form_enabled') === false) {
3131
$routeList['register'] = false;
3232
}
3333
Auth::routes($routeList);

tests/Feature/LoginAndRegistration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public function testRegisterUserWhenDisabled(): void
349349
{
350350
// Create a user by sending proper data
351351

352-
config(['auth.user_registration_form_enabled' => false]);
352+
config(['cdash.user_registration_form_enabled' => false]);
353353
$post_data = [
354354
'fname' => 'Test',
355355
'lname' => 'User',
@@ -370,7 +370,7 @@ public function testDisabledRegistrationForm(): void
370370
{
371371
// Disable username+password authentication and verify that the
372372
// form is no longer displayed.
373-
config(['auth.user_registration_form_enabled' => false]);
373+
config(['cdash.user_registration_form_enabled' => false]);
374374
$response = $this->get('/register');
375375
$response->assertStatus(404);
376376
}

0 commit comments

Comments
 (0)