Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

Commit d843f73

Browse files
authored
Merge pull request #198 from ExpDev07/dev
Bugfix
2 parents accd6af + 9c3734b commit d843f73

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

app/Http/Controllers/Auth/SteamController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Helpers\LoggingHelper;
66
use App\Helpers\SessionHelper;
7+
use App\Http\Middleware\StaffMiddleware;
78
use App\Player;
89
use App\User;
910
use Illuminate\Http\Request;
@@ -61,6 +62,8 @@ public function authenticated(Request $request, SteamUser $steam)
6162
LoggingHelper::log($session->getSessionKey(), 'Putting user in session');
6263
$session->put('user', $user);
6364

65+
StaffMiddleware::updateSessionLock();
66+
6467
if ($session->exists('returnTo')) {
6568
return redirect($session->get('returnTo'));
6669
}

app/Http/Middleware/StaffMiddleware.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,30 @@ protected function checkSessionLock(): bool
116116

117117
return $valid;
118118
} else {
119-
$session->put('session_lock', $this->getFingerprint());
120-
$session->put('session_detail', $detail);
119+
self::updateSessionLock();
121120
return true;
122121
}
123122
}
124123

125-
private function getFingerprint(): string
124+
public static function updateSessionLock()
125+
{
126+
$detail = [
127+
'ua' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
128+
'ip' => $_SERVER['REMOTE_ADDR'],
129+
];
130+
131+
$session = SessionHelper::getInstance();
132+
133+
$session->put('session_lock', self::getFingerprint());
134+
$session->put('session_detail', $detail);
135+
}
136+
137+
public static function getFingerprint(): string
126138
{
127139
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
128140
$ip = $_SERVER['REMOTE_ADDR'];
129141

130-
return sha1($ua . '_' . $ip);
142+
return md5($ua . '_' . $ip);
131143
}
132144

133145
/**

0 commit comments

Comments
 (0)