Proje dosyaları eklendi

This commit is contained in:
2026-08-29 15:53:53 +03:00
commit d3313400ca
440 changed files with 24827 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Support;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
final class AuthenticatedRedirect
{
private const UNSAFE = ['/', '/login', '/admin/login', '/logout', '/register', '/forgot-password', '/reset-password', '/locale'];
/**
* Müşteri giriş adresinden doğrulanan kullanıcıyı müşteri paneline yönlendirir.
*
* Kullanıcının ek yönetim rolleri hedef paneli değiştirmez; panel bağlamını
* kimlik doğrulamasının başlatıldığı giriş adresi belirler.
*
* @return string Müşteri kontrol panelinin göreli adresi.
*
* @author Gökhan Engin - İletişim : https://bit.ly/YazılımUzmanı
*/
public function landing(): string
{
return route('dashboard', absolute: false);
}
public function intended(Request $r): ?string
{
$value = $r->session()->pull('url.intended');
if (! is_string($value) || $value === '') {
return null;
}$parts = parse_url($value);
if ($parts === false) {
return null;
}if (isset($parts['host'])) {
$port = $parts['port'] ?? (($parts['scheme'] ?? '') === 'https' ? 443 : 80);
if (($parts['scheme'] ?? null) !== $r->getScheme() || $parts['host'] !== $r->getHost() || $port !== $r->getPort()) {
return null;
}$value = ($parts['path'] ?? '/').(isset($parts['query']) ? '?'.$parts['query'] : '');
}$decoded = $value;
for ($i = 0; $i < 3; $i++) {
$decoded = rawurldecode($decoded);
}if (! str_starts_with($decoded, '/') || str_starts_with($decoded, '//') || Str::contains($decoded, ["\r", "\n", '\\'])) {
return null;
}$path = '/'.ltrim((string) parse_url($decoded, PHP_URL_PATH), '/');
if (in_array(rtrim($path, '/') ?: '/', self::UNSAFE, true) || str_starts_with($path, '/admin')) {
return null;
}
return $value;
}
}