diff --git a/app/cdash/tests/kwtest/kw_web_tester.php b/app/cdash/tests/kwtest/kw_web_tester.php index 7389d31195..240dfa9368 100644 --- a/app/cdash/tests/kwtest/kw_web_tester.php +++ b/app/cdash/tests/kwtest/kw_web_tester.php @@ -536,7 +536,8 @@ public function getGuzzleClient($username = 'simpletest@localhost', $html = "{$response->getBody()}"; $dom = new DOMDocument(); @$dom->loadHTML($html); - $token = $dom->getElementById('csrf-token') + $token = $dom->getElementsByTagName('input') + ->item(0) ->getAttribute('value'); $response = $client->request('POST', diff --git a/config/saml2.php b/config/saml2.php index b01c3ceda7..8716be1982 100644 --- a/config/saml2.php +++ b/config/saml2.php @@ -5,7 +5,7 @@ 'enabled' => env('SAML2_ENABLED', false), /* What text to display in the SAML2 login button */ - 'login_text' => env('SAML2_LOGIN_TEXT', 'SAML2'), + 'login_text' => env('SAML2_LOGIN_TEXT', 'Sign in with SAML2'), /* Whether or not to automatically register new users */ 'autoregister_new_users' => env('SAML2_AUTO_REGISTER_NEW_USERS', false), diff --git a/config/services.php b/config/services.php index c03b1687d8..9aa3f9d7c8 100755 --- a/config/services.php +++ b/config/services.php @@ -20,7 +20,7 @@ 'redirect' => env('APP_URL') . '/auth/github/callback', 'enable' => env('GITHUB_ENABLE', false), 'oauth' => true, - 'display_name' => env('GITHUB_DISPLAY_NAME', 'GitHub'), + 'display_name' => env('GITHUB_DISPLAY_NAME', 'Sign in with GitHub'), ], 'gitlab' => [ 'client_id' => env('GITLAB_CLIENT_ID'), @@ -29,7 +29,7 @@ 'instance_uri' => env('GITLAB_DOMAIN'), 'enable' => env('GITLAB_ENABLE', false), 'oauth' => true, - 'display_name' => env('GITLAB_DISPLAY_NAME', 'GitLab'), + 'display_name' => env('GITLAB_DISPLAY_NAME', 'Sign in with GitLab'), ], 'google' => [ @@ -39,7 +39,7 @@ 'redirect' => env('APP_URL') . '/auth/google/callback', 'enable' => env('GOOGLE_ENABLE', false), 'oauth' => true, - 'display_name' => env('GOOGLE_DISPLAY_NAME', 'Google'), + 'display_name' => env('GOOGLE_DISPLAY_NAME', 'Sign in with Google'), ], 'pingidentity' => [ @@ -52,7 +52,7 @@ 'user_endpoint' => env('PINGIDENTITY_USER_ENDPOINT', '/idp/userinfo.openid'), 'enable' => env('PINGIDENTITY_ENABLE', false), 'oauth' => true, - 'display_name' => env('PINGIDENTITY_DISPLAY_NAME', 'PingIdentity'), + 'display_name' => env('PINGIDENTITY_DISPLAY_NAME', 'Sign in with PingIdentity'), ], 'mailgun' => [ diff --git a/docs/authentication.md b/docs/authentication.md index 93baf83749..07869c1cf2 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -69,7 +69,7 @@ To begin, you will need to | GITHUB_CLIENT_ID | The Client ID assigned to your GitHub OAuth2 app. | '' | | GITHUB_CLIENT_SECRET | The Client Secret created for your GitHub OAuth2 app. | '' | | GITHUB_AUTO_REGISTER_NEW_USERS | Whether to automatically register a new user or provide them the Registration form | false | -| GITHUB_DISPLAY_NAME | The text displayed on the GitHub OAuth2 login button | GitHub | +| GITHUB_DISPLAY_NAME | The text displayed on the GitHub OAuth2 login button | Sign in with GitHub | ###### GitLab @@ -82,7 +82,7 @@ First [configure GitLab as an OAuth2 authentication identity provider](https://d | GITLAB_CLIENT_SECRET | The OAuth 2 Client Secret from the Secret field. | '' | | GITLAB_DOMAIN | The GitLab server to authenticate against. | https://gitlab.com | | GITLAB_AUTO_REGISTER_NEW_USERS | Whether to automatically register a new user or provide them the Registration form | false | -| GITLAB_DISPLAY_NAME | The text displayed on the GitLab OAuth2 login button | GitLab | +| GITLAB_DISPLAY_NAME | The text displayed on the GitLab OAuth2 login button | Sign in with GitLab | ###### Google @@ -94,7 +94,7 @@ Begin by [creating OAuth2 credentials for your Google project](https://developer | GOOGLE_CLIENT_ID | The client ID from your Google OAuth2 credentials. | '' | | GOOGLE_CLIENT_SECRET | The client secret from your Google OAuth2 credentials. | '' | | GOOGLE_AUTO_REGISTER_NEW_USERS | Whether to automatically register a new user or provide them the Registration form | false | -| GOOGLE_DISPLAY_NAME | The text displayed on the Google OAuth2 login button | Google | +| GOOGLE_DISPLAY_NAME | The text displayed on the Google OAuth2 login button | Sign in with Google | ###### PingIdentity @@ -110,7 +110,7 @@ Begin by [creating OAuth2 client in your PingIdentity console](https://docs.ping | PINGIDENTITY_TOKEN_ENDPOINT | The URL fragment to the endpoint to ask for the Token | '/as/token.oauth2' | | PINGIDENTITY_USER_ENDPOINT | The URL fragment to the endpoint to ask for the user's information with the token | '/idp/userinfo.openid' | | PINGIDENTITY_AUTO_REGISTER_NEW_USERS | Whether to automatically register a new user or provide them the Registration form | false | -| PINGIDENTITY_DISPLAY_NAME | The text displayed on the PingIdentity OAuth2 login button | PingIdentity | +| PINGIDENTITY_DISPLAY_NAME | The text displayed on the PingIdentity OAuth2 login button | Sign in with PingIdentity | ## SAML2 @@ -122,6 +122,6 @@ Relevant `.env` variables for CDash SAML2 authentication: | Variable | Description | Default | | -------- |------------ | ------- | | SAML2_ENABLED | Whether or not to use SAML2 authentication. | false | -| SAML2_LOGIN_TEXT | What text to display in the SAML2 login button. | SAML2 | +| SAML2_LOGIN_TEXT | What text to display in the SAML2 login button. | Sign in with SAML2 | | SAML2_AUTO_REGISTER_NEW_USERS | Whether or not to automatically register new users upon first login. | false | | SAML2_PROXY_VARS | Whether or not to trust the X-Forwarded-Proto HTTP header | false | diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 573895b0f3..d489ec8995 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -18574,19 +18574,19 @@ parameters: path: app/cdash/tests/kwtest/kw_web_tester.php - - rawMessage: 'Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:832::__construct() has parameter $response with no type specified.' + rawMessage: 'Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:833::__construct() has parameter $response with no type specified.' identifier: missingType.parameter count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php - - rawMessage: 'Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:832::getSent() has no return type specified.' + rawMessage: 'Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:833::getSent() has no return type specified.' identifier: missingType.return count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php - - rawMessage: 'Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:832::read() has no return type specified.' + rawMessage: 'Method class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:833::read() has no return type specified.' identifier: missingType.return count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php @@ -18814,7 +18814,7 @@ parameters: path: app/cdash/tests/kwtest/kw_web_tester.php - - rawMessage: Property class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:832::$read has no type specified. + rawMessage: Property class@anonymous/app/cdash/tests/kwtest/kw_web_tester.php:833::$read has no type specified. identifier: missingType.property count: 1 path: app/cdash/tests/kwtest/kw_web_tester.php diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 18b332859a..b0e0eaa935 100755 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -1,9 +1,6 @@ @php - $oauthCollection = collect(config('oauth2')); - $has_oauth2_login = $oauthCollection->firstWhere('enable', true); - - $socialiteCollection = collect(config('services'))->where("oauth","true"); - $has_socialite_login = $socialiteCollection->firstWhere('enable', true); + $oauthCollection = collect(config('services'))->where("oauth","true"); + $has_oauth_login = $oauthCollection->firstWhere('enable', true); $has_saml2_login = config('saml2.enabled'); $saml2_login_text = config('saml2.login_text'); @@ -13,92 +10,77 @@ $title = 'Login'; @endphp -@extends('cdash') +@extends('cdash', [ + 'vue' => true, + 'daisyui' => true, +]) @section('main_content') - @includeIf('local.login')
- @if ($show_login_form) -
- -
-
- {{ $login_field }}: -
-
- - @if ($errors->has('email')) -
- - {{ $errors->first('email') }} - -
- @endif -
+
+ @if(View::exists('local.login')) +
+ @include('local.login')
-
-
- Password: -
-
- - Remember Me - @if ($errors->has('password')) -
- - {{ $errors->first('password') }} - -
- @endif -
-
-
-
-
-
- -
-
- @if (Route::has('password.request')) - Forgot your password? - @endif -
-
- - @endif - - @if ($has_oauth2_login || $has_saml2_login || $has_socialite_login) -
-
-

- Sign in with: - @if ($has_saml2_login) -

- - -
- @endif - @foreach($socialiteCollection as $key => $config) - @if ($config['enable']) - - - - @endif - @endforeach - @foreach($oauthCollection as $key => $config) + @endif +
+ @if ($show_login_form) +
+ @csrf +
+ CDash logo +
+ + + +
+ @endif + @if($show_login_form && ($has_saml2_login || $has_oauth_login)) +
OR
+ @endif + @if($has_saml2_login) +
+ @csrf + +
+ @endif + @if($has_oauth_login) + @foreach($oauthCollection as $provider => $config) @if ($config['enable']) - - + + Log in with your {{ $provider }} account + {{ $config['display_name']}} @endif @endforeach -

+ @endif
- @endif @endsection diff --git a/tests/Feature/CDashTest.php b/tests/Feature/CDashTest.php index d192968c74..32b7abe429 100755 --- a/tests/Feature/CDashTest.php +++ b/tests/Feature/CDashTest.php @@ -88,7 +88,8 @@ public function testOverrideLoginField(): void URL::forceRootUrl('http://localhost'); Config::set('cdash.login_field', 'User'); $this->get('/login') - ->assertSeeText('User:'); + ->assertSeeText('User') + ->assertDontSeeText('Email'); } public function testViewProjectsRedirectNoPublicProjects(): void diff --git a/tests/Feature/LoginAndRegistration.php b/tests/Feature/LoginAndRegistration.php index 7a581b0d57..d56d2331ce 100644 --- a/tests/Feature/LoginAndRegistration.php +++ b/tests/Feature/LoginAndRegistration.php @@ -50,7 +50,7 @@ public function testCanViewLoginForm(): void // Verify that the normal login form is shown by default. $response = $this->get('/login'); $response->assertOk(); - $response->assertSeeText('Email:'); + $response->assertSeeText('Email'); } public function testRegisterUser(): void