Compare commits

..

2 Commits

Author SHA1 Message Date
6d90af8005 Merge pull request 'update changes' (#2) from subhajit_changes_06_07 into main
Reviewed-on: #2
2026-07-07 11:59:23 +00:00
65e153153f update changes 2026-07-07 16:53:32 +05:30
3 changed files with 274 additions and 0 deletions

View File

@ -98,6 +98,31 @@ public function handleSSOCallback(Request $request)
$targetUrl = session('sso_target_url', 'https://outlook.office.com/mail/'); $targetUrl = session('sso_target_url', 'https://outlook.office.com/mail/');
session()->forget('sso_target_url'); session()->forget('sso_target_url');
// If launching Microsoft Teams, redirect to the deep link launcher page
if (str_contains($targetUrl, 'teams.microsoft.com')) {
return redirect()->route('sso.launch-app', [
'name' => 'Microsoft Teams',
'url' => $targetUrl,
'protocol' => 'msteams://'
]);
}
return redirect($targetUrl); return redirect($targetUrl);
} }
/**
* Render the desktop application launcher page with web fallback.
*/
public function launchApp(Request $request)
{
$name = $request->query('name', 'Application');
$url = $request->query('url');
$protocol = $request->query('protocol');
if (!$url || !$protocol) {
return redirect()->route('dashboard');
}
return view('sso.launch-app', compact('name', 'url', 'protocol'));
}
} }

View File

@ -0,0 +1,248 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Launching {{ $name }} - SingleLogin</title>
<!-- Google Fonts: Outfit & Inter -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #0b0f19;
--card-bg: rgba(17, 24, 39, 0.7);
--card-border: rgba(255, 255, 255, 0.08);
--accent-primary: #4f46e5;
--accent-secondary: #0078d4;
--text-main: #f3f4f6;
--text-muted: #9ca3af;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-color);
color: var(--text-main);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
position: relative;
}
/* Glowing background circles */
body::before {
content: '';
position: absolute;
width: 500px;
height: 500px;
border-radius: 50%;
background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
top: -100px;
right: -100px;
z-index: -1;
}
body::after {
content: '';
position: absolute;
width: 400px;
height: 400px;
border-radius: 50%;
background: radial-gradient(circle, rgba(0, 120, 212, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
bottom: -100px;
left: -100px;
z-index: -1;
}
.launcher-card {
background-color: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 20px;
padding: 40px;
text-align: center;
max-width: 500px;
width: 90%;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
animation: fadeIn 0.5s ease-out;
}
.loader-container {
position: relative;
width: 80px;
height: 80px;
margin: 0 auto 30px;
}
.spinner {
box-sizing: border-box;
display: block;
position: absolute;
width: 80px;
height: 80px;
border: 4px solid transparent;
border-radius: 50%;
animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-top-color: var(--accent-secondary);
}
.spinner-inner {
box-sizing: border-box;
display: block;
position: absolute;
width: 64px;
height: 64px;
margin: 8px;
border: 4px solid transparent;
border-radius: 50%;
animation: spin-reverse 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-top-color: var(--accent-primary);
}
.title {
font-family: 'Outfit', sans-serif;
font-size: 1.6rem;
font-weight: 700;
margin-bottom: 12px;
background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.subtitle {
font-size: 0.9rem;
color: var(--text-muted);
line-height: 1.6;
margin-bottom: 30px;
}
.btn-group {
display: flex;
flex-direction: column;
gap: 12px;
}
.btn {
padding: 12px 20px;
border-radius: 10px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.btn-primary {
background-color: var(--accent-primary);
border: 1px solid transparent;
color: white;
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
background-color: #4338ca;
transform: translateY(-1px);
}
.btn-secondary {
background-color: rgba(255, 255, 255, 0.04);
border: 1px solid var(--card-border);
color: var(--text-main);
}
.btn-secondary:hover {
background-color: rgba(255, 255, 255, 0.08);
border-color: rgba(255, 255, 255, 0.15);
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes spin-reverse {
0% { transform: rotate(0deg); }
100% { transform: rotate(-360deg); }
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div class="launcher-card">
<div class="loader-container">
<div class="spinner"></div>
<div class="spinner-inner"></div>
</div>
<h1 class="title">Opening {{ $name }} Desktop App</h1>
<p class="subtitle" id="status-text">
Attempting to launch the native {{ $name }} application on your device...<br>
If you don't see the app opening, we will redirect you to the web version in a few seconds.
</p>
<div class="btn-group">
<a href="#" onclick="launchAppDirectly(); return false;" class="btn btn-primary">
Try Opening App Again
</a>
<a href="{{ $url }}" id="web-fallback-link" class="btn btn-secondary">
Open in Web Browser Instead
</a>
</div>
</div>
<script>
const appUrl = "{{ $protocol }}";
const webUrl = "{{ $url }}";
let isRedirecting = false;
let isAppOpened = false;
// Try to detect if the window lost focus (user moved to the native app)
function handleBlur() {
isAppOpened = true;
document.getElementById('status-text').innerHTML =
'Successfully opened in the desktop app.<br>You can now safely close this browser tab.';
}
window.addEventListener('blur', handleBlur);
function launchAppDirectly() {
// Attempt to trigger the custom protocol
window.location.href = appUrl;
}
// Run the launch attempt on page load
window.onload = function() {
launchAppDirectly();
// Set a fallback timer. If the window did not lose focus (meaning app isn't open), redirect to web.
setTimeout(() => {
window.removeEventListener('blur', handleBlur);
if (!isAppOpened && !isRedirecting) {
isRedirecting = true;
document.getElementById('status-text').innerHTML =
'App not detected. Redirecting to the web version...';
window.location.href = webUrl;
}
}, 2500);
};
</script>
</body>
</html>

View File

@ -23,6 +23,7 @@
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard'); Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
Route::get('/sso/launch/{id}', [DashboardController::class, 'launchSSO'])->name('sso.launch'); Route::get('/sso/launch/{id}', [DashboardController::class, 'launchSSO'])->name('sso.launch');
Route::get('/sso/callback', [DashboardController::class, 'handleSSOCallback'])->name('sso.callback'); Route::get('/sso/callback', [DashboardController::class, 'handleSSOCallback'])->name('sso.callback');
Route::get('/sso/launch-app', [DashboardController::class, 'launchApp'])->name('sso.launch-app');
}); });
// Admin Control Panel (requires admin role) // Admin Control Panel (requires admin role)