Skip to content

Commit 70eb0da

Browse files
Merge pull request #1105 from Kitware/releases/3.0
Merge release branch back into master
2 parents 61ef950 + 030c919 commit 70eb0da

10 files changed

Lines changed: 87 additions & 228 deletions

File tree

app/Http/Controllers/CDash.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public function getJsVersion()
328328
$version = '';
329329
if (is_readable($path)) {
330330
$file = file_get_contents($path);
331-
if (preg_match("/'VERSION',\s+'(\d+)'/", $file, $match)) {
331+
if (preg_match("/'VERSION',\s+'([0-9.]+)'/", $file, $match)) {
332332
$version = $match[1];
333333
}
334334
}

app/Http/Middleware/CheckPassword.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Middleware;
44

5+
use CDash\Model\AuthToken;
56
use Closure;
67
use Illuminate\Support\Facades\Auth;
78
use Illuminate\Support\Str;
@@ -18,11 +19,28 @@ class CheckPassword
1819
public function handle($request, Closure $next)
1920
{
2021
$password_expired_path = '/editUser.php';
21-
if (Auth::check() && !Str::contains(url()->current(), $password_expired_path)) {
22-
$user = Auth::user();
23-
if ($user->hasExpiredPassword()) {
24-
$password_expired_uri = "{$password_expired_path}?password_expired=1";
25-
return redirect($password_expired_uri);
22+
if (Auth::check()) {
23+
if (!Str::contains(url()->current(), $password_expired_path)) {
24+
$user = Auth::user();
25+
if ($user->hasExpiredPassword()) {
26+
$password_expired_uri = "{$password_expired_path}?password_expired=1";
27+
return redirect($password_expired_uri);
28+
}
29+
}
30+
} else {
31+
// Make sure we have a database before proceeding.
32+
try {
33+
\DB::connection()->getPdo();
34+
} catch (\Exception $e) {
35+
return $next($request);
36+
}
37+
38+
// Check for the presence of a bearer token if we are not
39+
// already authenticated.
40+
$authtoken = new AuthToken();
41+
$userid = $authtoken->getUserIdFromRequest();
42+
if (!is_null($userid)) {
43+
Auth::loginUsingId($userid);
2644
}
2745
}
2846

app/cdash/app/Model/AuthToken.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use CDash\Config;
2020
use CDash\Database;
2121

22+
require_once 'include/pdo.php';
23+
2224
/** AuthToken class */
2325
class AuthToken
2426
{

app/cdash/include/api_common.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
use App\Services\ProjectPermissions;
2020

21-
use CDash\Model\AuthToken;
2221
use CDash\Model\Build;
2322
use CDash\Model\Project;
2423
use CDash\ServiceContainer;
@@ -108,13 +107,6 @@ function get_userid_from_session($required = true)
108107
{
109108
$userid = Auth::id();
110109

111-
// Check for the presence of a bearer token if no userid was found
112-
// in the session.
113-
if (is_null($userid)) {
114-
$authtoken = new AuthToken();
115-
$userid = $authtoken->getUserIdFromRequest();
116-
}
117-
118110
if ($required && is_null($userid)) {
119111
$response = ['error' => 'Permission denied'];
120112
json_error_response($response, 403);

app/cdash/include/common.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
use CDash\Config;
2222
use CDash\Database;
23-
use CDash\Model\AuthToken;
2423
use CDash\ServiceContainer;
2524
use CDash\Model\Build;
2625
use CDash\Model\Project;

app/cdash/php.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ log_errors = On
66
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
77

88
memory_limit = 512M
9+
10+
xdebug.mode=coverage

app/cdash/public/ajax/clientchecksystem.php

Lines changed: 0 additions & 170 deletions
This file was deleted.

package-lock.json

Lines changed: 14 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"angular-ui-sortable": "^0.14.3",
2323
"ansi_up": "^3.0.0",
2424
"as-jqplot": "^1.0.8",
25-
"axios": "^0.18",
25+
"axios": "^0.21",
2626
"bootstrap": "^4.4.1",
2727
"bootstrap-vue": "^2.11.0",
2828
"cross-env": "^5.1",

0 commit comments

Comments
 (0)