initial commit

This commit is contained in:
subhajit 2026-06-23 14:36:43 +05:30
commit 49e1a5d20f
66 changed files with 14920 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[{compose,docker-compose}.{yml,yaml}]
indent_size = 4

71
.env.example Normal file
View File

@ -0,0 +1,71 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=singlelogin
DB_USERNAME=root
DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"
# Microsoft Azure OAuth Configurations
MICROSOFT_CLIENT_ID=
MICROSOFT_CLIENT_SECRET=
MICROSOFT_REDIRECT_URI="${APP_URL}/auth/microsoft/callback"
MICROSOFT_TENANT_ID=common

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

27
.gitignore vendored Normal file
View File

@ -0,0 +1,27 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.codex
/.cursor/
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/fonts-manifest.dev.json
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
_ide_helper.php
Homestead.json
Homestead.yaml
Thumbs.db

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
ignore-scripts=true
audit=true

58
README.md Normal file
View File

@ -0,0 +1,58 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals.
## Agentic Development
Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow:
```bash
composer require laravel/boost --dev
php artisan boost:install
```
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices.
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AdminController extends Controller
{
/**
* Show the administrator control panel.
*/
public function index()
{
$admin = Auth::user();
// Fetch all users to display on the dashboard for administration
$users = User::orderBy('created_at', 'desc')->get();
// Calculate statistics
$stats = [
'total_users' => User::count(),
'admins_count' => User::where('role', 'admin')->count(),
'microsoft_users' => User::whereNotNull('microsoft_id')->count(),
'credentials_users' => User::whereNull('microsoft_id')->count(),
];
return view('admin.dashboard', compact('admin', 'users', 'stats'));
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
/**
* Show the user dashboard.
*/
public function index()
{
$user = Auth::user();
// Service list with URLs and aesthetic tags
$services = [
[
'name' => 'Outlook',
'url' => 'https://outlook.office.com/mail/',
'icon_svg' => 'outlook',
'color' => '#0078d4',
'desc' => 'Access your corporate mail, calendar, and contacts instantly.',
'tag' => 'Microsoft 365'
],
[
'name' => 'Microsoft Teams',
'url' => 'https://teams.microsoft.com/v2/',
'icon_svg' => 'teams',
'color' => '#6264a7',
'desc' => 'Chat, meet, call, and collaborate with your team.',
'tag' => 'Microsoft 365'
],
[
'name' => 'Keka HR',
'url' => 'https://sentientgeeks.keka.com/',
'icon_svg' => 'keka',
'color' => '#f27059',
'desc' => 'Manage timesheets, leaves, payroll, and performance tasks.',
'tag' => 'HR Portal'
],
];
return view('dashboard', compact('user', 'services'));
}
}

View File

@ -0,0 +1,149 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Laravel\Socialite\Facades\Socialite;
class LoginController extends Controller
{
/**
* Show the login selection screen or redirect if already authenticated.
*/
public function showLoginForm()
{
if (Auth::check()) {
return $this->redirectUserBasedOnRole(Auth::user());
}
return view('auth.login');
}
/**
* Handle Email & Password login for Administrators.
*/
public function adminLogin(Request $request)
{
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
if (Auth::attempt($credentials, $request->boolean('remember'))) {
$user = Auth::user();
// Enforce that only administrators can log in via credentials
if ($user->role === 'admin') {
$request->session()->regenerate();
return redirect()->intended(route('admin.dashboard'))
->with('success', 'Logged in successfully as Admin.');
}
// Log out unauthorized user immediately
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return back()->withErrors([
'email' => 'Access denied. The provided credentials do not belong to an Administrator.',
])->onlyInput('email');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
])->onlyInput('email');
}
/**
* Redirect the user to the Microsoft Azure authentication page.
*/
public function redirectToMicrosoft()
{
try {
return Socialite::driver('microsoft')->redirect();
} catch (Exception $e) {
\Illuminate\Support\Facades\Log::error('Microsoft Authentication redirect failed', [
'message' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
]);
return redirect()->route('login')->with('error', 'Unable to redirect to Microsoft: ' . $e->getMessage());
}
}
/**
* Obtain the user information from Microsoft Azure.
*/
public function handleMicrosoftCallback(Request $request)
{
try {
$microsoftUser = Socialite::driver('microsoft')->user();
} catch (Exception $e) {
\Illuminate\Support\Facades\Log::error('Microsoft Authentication callback failed', [
'message' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
]);
return redirect()->route('login')->with('error', 'Microsoft Authentication failed or was cancelled: ' . $e->getMessage());
}
// Search for user by microsoft_id first, then by email
$user = User::where('microsoft_id', $microsoftUser->getId())->first();
if (!$user) {
$user = User::where('email', $microsoftUser->getEmail())->first();
}
if ($user) {
// Update existing user with Microsoft data if not already set
$user->update([
'microsoft_id' => $microsoftUser->getId(),
'microsoft_token' => $microsoftUser->token,
'microsoft_refresh_token' => $microsoftUser->refreshToken ?? $user->microsoft_refresh_token,
'avatar' => $microsoftUser->getAvatar() ?? $user->avatar,
]);
} else {
// Create a new User (defaults to 'user' role)
$user = User::create([
'name' => $microsoftUser->getName() ?? explode('@', $microsoftUser->getEmail())[0],
'email' => $microsoftUser->getEmail(),
'microsoft_id' => $microsoftUser->getId(),
'microsoft_token' => $microsoftUser->token,
'microsoft_refresh_token' => $microsoftUser->refreshToken ?? null,
'avatar' => $microsoftUser->getAvatar(),
'role' => 'user',
]);
}
Auth::login($user, true);
$request->session()->regenerate();
return $this->redirectUserBasedOnRole($user);
}
/**
* Log the user out of the application.
*/
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login')->with('success', 'Logged out successfully.');
}
/**
* Helper method to redirect user depending on their role.
*/
protected function redirectUserBasedOnRole($user)
{
if ($user->role === 'admin') {
return redirect()->route('admin.dashboard');
}
return redirect()->route('dashboard');
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class EnsureRole
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next, string $role): Response
{
if (!auth()->check()) {
return redirect()->route('login')->with('error', 'Please log in to access this page.');
}
if (auth()->user()->role !== $role) {
if (auth()->user()->role === 'admin') {
return redirect()->route('admin.dashboard');
}
return redirect()->route('dashboard')->with('error', 'Unauthorized access.');
}
return $next($request);
}
}

40
app/Models/User.php Normal file
View File

@ -0,0 +1,40 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
#[Fillable(['name', 'email', 'password', 'role', 'microsoft_id', 'microsoft_token', 'microsoft_refresh_token', 'avatar'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* Check if user is an admin.
*/
public function isAdmin(): bool
{
return $this->role === 'admin';
}
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
use SocialiteProviders\Manager\SocialiteWasCalled;
use SocialiteProviders\Microsoft\MicrosoftExtendSocialite;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Event::listen(
SocialiteWasCalled::class,
MicrosoftExtendSocialite::class
);
}
}

18
artisan Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);

23
bootstrap/app.php Normal file
View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->alias([
'role' => \App\Http\Middleware\EnsureRole::class,
]);
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
fn (Request $request) => $request->is('api/*'),
);
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

7
bootstrap/providers.php Normal file
View File

@ -0,0 +1,7 @@
<?php
use App\Providers\AppServiceProvider;
return [
AppServiceProvider::class,
];

91
composer.json Normal file
View File

@ -0,0 +1,91 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": [
"laravel",
"framework"
],
"license": "MIT",
"require": {
"php": "^8.3",
"laravel/framework": "^13.8",
"laravel/socialite": "^5.28",
"laravel/tinker": "^3.0",
"socialiteproviders/microsoft": "^4.9"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.5",
"laravel/pao": "^1.0.6",
"laravel/pint": "^1.27",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^12.5.12"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install --ignore-scripts",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" --names='server,queue,vite'"
],
"test": [
"@php artisan config:clear --ansi @no_additional_args",
"@php artisan test"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8862
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

117
config/auth.php Normal file
View File

@ -0,0 +1,117 @@
<?php
use App\Models\User;
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

136
config/cache.php Normal file
View File

@ -0,0 +1,136 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "storage", "octane",
| "session", "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'storage' => [
'driver' => 'storage',
'disk' => env('CACHE_STORAGE_DISK'),
'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
/*
|--------------------------------------------------------------------------
| Serializable Classes
|--------------------------------------------------------------------------
|
| This value determines the classes that can be unserialized from cache
| storage. By default, no PHP classes will be unserialized from your
| cache to prevent gadget chain attacks if your APP_KEY is leaked.
|
*/
'serializable_classes' => false,
];

184
config/database.php Normal file
View File

@ -0,0 +1,184 @@
<?php
use Illuminate\Support\Str;
use Pdo\Mysql;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

118
config/mail.php Normal file
View File

@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
],
];

129
config/queue.php Normal file
View File

@ -0,0 +1,129 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "background", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

45
config/services.php Normal file
View File

@ -0,0 +1,45 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
'microsoft' => [
'client_id' => env('MICROSOFT_CLIENT_ID', env('MICROSOFT_GRAPH_CLIENT_ID')),
'client_secret' => env('MICROSOFT_CLIENT_SECRET', env('MICROSOFT_GRAPH_CLIENT_SECRET')),
'redirect' => env('MICROSOFT_REDIRECT_URI', env('APP_URL', 'http://localhost:8000') . '/auth/microsoft/callback'),
'tenant' => env('MICROSOFT_TENANT_ID', env('MICROSOFT_GRAPH_TENANT_ID', 'common')),
],
];

233
config/session.php Normal file
View File

@ -0,0 +1,233 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "memcached",
| "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain without subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
/*
|--------------------------------------------------------------------------
| Session Serialization
|--------------------------------------------------------------------------
|
| This value controls the serialization strategy for session data, which
| is JSON by default. Setting this to "php" allows the storage of PHP
| objects in the session but can make an application vulnerable to
| "gadget chain" serialization attacks if the APP_KEY is leaked.
|
| Supported: "json", "php"
|
*/
'serialization' => 'json',
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,45 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,54 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password')->nullable();
$table->string('role')->default('user');
$table->string('microsoft_id')->nullable()->unique();
$table->longText('microsoft_token')->nullable();
$table->longText('microsoft_refresh_token')->nullable();
$table->longText('avatar')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedSmallInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('connection');
$table->string('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
$table->index(['connection', 'queue', 'failed_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,40 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
// Seed default administrator
User::updateOrCreate(
['email' => 'admin@company.com'],
[
'name' => 'System Administrator',
'password' => Hash::make('Admin@123'),
'role' => 'admin',
]
);
// Seed default standard user (without password since users use Microsoft OAuth)
User::updateOrCreate(
['email' => 'user@company.com'],
[
'name' => 'John Doe User',
'role' => 'user',
'microsoft_id' => 'mock-microsoft-id-123',
]
);
}
}

1656
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"$schema": "https://www.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^3.1",
"tailwindcss": "^4.0.0",
"vite": "^8.0.0"
}
}

36
phpunit.xml Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="BROADCAST_CONNECTION" value="null"/>
<env name="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="DB_URL" value=""/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="NIGHTWATCH_ENABLED" value="false"/>
</php>
</phpunit>

127
plan.md Normal file
View File

@ -0,0 +1,127 @@
# Role-Based Login & Microsoft SSO System Plan
We will build a two-role authentication system (Admin & User) in Laravel, integrating Microsoft OAuth (via Laravel Socialite) for users, and dual authentication (Microsoft + email/password) for admins.
---
## 1. Authentication Flows & Security
```mermaid
graph TD
A[Visitor] --> B{Choose Path}
B -->|User| C[Login via Microsoft]
B -->|Admin| D[Login via Microsoft OR Email/Password]
C --> E[Redirect to Microsoft Azure AD]
E --> F[Microsoft Callback]
F -->|Success| G{Is User Registered?}
G -->|No| H[Create User Record with 'user' role]
G -->|Yes| I[Log User In]
I --> J[Redirect to Dashboard]
D -->|Microsoft| E
D -->|Email/Password| K[Laravel Auth Attempt]
K -->|Success| L[Verify Role is 'admin']
L -->|Yes| M[Redirect to Admin Dashboard]
L -->|No| N[Redirect Back with Error]
```
### Roles Defined:
1. **User**: Authenticatable **ONLY** via Microsoft. Accesses `/dashboard`, sees service icons (Keka, Teams, Outlook) which log them in silently.
2. **Admin**: Authenticatable via **BOTH** Microsoft and standard Email/Password credentials. Accesses `/admin/dashboard` (and can also access the user dashboard if needed).
---
## 2. Technical Roadmap
### Step 1: Install Dependencies
We will install Laravel Socialite and the Microsoft Graph Socialite provider:
```bash
composer require laravel/socialite
composer require socialiteproviders/microsoft
```
### Step 2: Configure Service Provider & Credentials
1. Register the Socialite listener in [AppServiceProvider.php](file:///D:/projects/singlelogin/app/Providers/AppServiceProvider.php):
```php
use SocialiteProviders\Manager\SocialiteWasCalled;
use SocialiteProviders\Microsoft\MicrosoftExtendSocialite;
Event::listen(function (SocialiteWasCalled $event) {
$event->extendSocialite('microsoft', MicrosoftExtendSocialite::class);
});
```
2. Configure `config/services.php` to include:
```php
'microsoft' => [
'client_id' => env('MICROSOFT_CLIENT_ID'),
'client_secret' => env('MICROSOFT_CLIENT_SECRET'),
'redirect' => env('MICROSOFT_REDIRECT_URI'),
'tenant' => env('MICROSOFT_TENANT_ID', 'common'),
],
```
3. Set the variables in `.env`:
- `MICROSOFT_CLIENT_ID`
- `MICROSOFT_CLIENT_SECRET`
- `MICROSOFT_REDIRECT_URI=http://localhost:8000/auth/microsoft/callback`
- `MICROSOFT_TENANT_ID=common`
### Step 3: Database & Migration Updates
Modify `database/migrations/0001_01_01_000000_create_users_table.php` to include:
- `role` (string, defaults to `'user'`)
- `microsoft_id` (string, nullable)
- `microsoft_token` (text, nullable)
- `microsoft_refresh_token` (text, nullable)
- `avatar` (string, nullable)
- Allow `password` to be nullable (since Users log in strictly via Microsoft and won't have a local password).
We will write a `DatabaseSeeder` to generate:
- A default Administrator account (e.g., `admin@company.com` / `Admin@123`) to test email/password login.
### Step 4: Middleware & Gates
Create middleware files:
1. `EnsureAdmin` - Redirects non-admins away from `/admin/*`.
2. `EnsureUser` - Redirects non-users (or unauthenticated users) away from `/dashboard`.
Register them in `bootstrap/app.php` (under `$middleware->alias(...)` or use route groups).
### Step 5: Routes & Controllers
We will define the following routes in [web.php](file:///D:/projects/singlelogin/routes/web.php):
| Route | Method | Controller Action | Description |
|---|---|---|---|
| `/` | GET | `LoginController@index` | Auto-redirects logged-in users, or renders Login page |
| `/login` | GET | `LoginController@showLoginForm` | Beautiful interactive login page |
| `/login/admin` | POST | `LoginController@adminLogin` | Handle admin email/password login |
| `/auth/microsoft/redirect` | GET | `LoginController@redirectToMicrosoft` | Redirects to Microsoft OAuth |
| `/auth/microsoft/callback` | GET | `LoginController@handleMicrosoftCallback` | Processes OAuth callback & logs in user |
| `/dashboard` | GET | `DashboardController@index` | User Dashboard with Services (Keka, Outlook, Teams) |
| `/admin/dashboard` | GET | `AdminController@index` | Admin Control Panel |
| `/logout` | POST | `LoginController@logout` | Standard Logout |
### Step 6: Silent SSO / Services Integration
* **Mechanism**: When users log in via Microsoft, Microsoft creates authentication cookies in the browser session.
* **Flow**:
- The Dashboard features cards for:
- **Outlook**: links to `https://outlook.office.com/mail/`
- **Teams**: links to `https://teams.microsoft.com/v2/`
- **Keka**: links to `https://my.keka.com/` (or a configured company portal)
- Clicking these cards opens them in a new tab (`target="_blank"`).
- Since the active browser session contains Microsoft's authentication cookies from our login flow, Microsoft SSO automatically authenticates the user into these applications. They bypass login prompts and access their accounts directly (silently).
- We will provide mock buttons in local testing mode to simulate the SSO authentication if required, or simply redirect to the live services.
### Step 7: UI/UX & Design System (Aesthetics)
We will build a high-fidelity visual experience:
- **Typography**: Outfit or Inter font, clean structure.
- **Login Screen**: Glassmorphism dashboard card, subtle background gradients, hover glow effects, micro-animations on input focuses, and a dual toggle between "User Portal" (Microsoft SSO only) and "Admin Portal" (Credentials + Microsoft SSO).
- **Dashboard**: A premium modern portal featuring grid cards representing each service with clean hover animations, active session banners, profile widgets showing Microsoft avatars, and interactive logs.
---
## 3. Review Questions & Feedback
Please review this plan and let me know:
1. **Database Type**: Should we use SQLite (`database.sqlite`) for easier local development/testing of this feature, or is your local MySQL server ready to connect as specified in `.env`?
2. **Microsoft App Credentials**: Do you have a Microsoft Azure AD app registration ready? If not, I can provide instructions on how to create one in the Azure Portal (registers client ID, secret, and redirect URI).
3. **App Selection**: Are Keka, Outlook, and Teams the exact external links you want, or would you like to configure custom enterprise dashboard URLs?
**Let me know if you approve this plan or if you want to modify any details, and we'll begin implementation!**

25
public/.htaccess Normal file
View File

@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

BIN
public/Screenshot_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

0
public/favicon.ico Normal file
View File

20
public/index.php Normal file
View File

@ -0,0 +1,20 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Request::capture());

2
public/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

9
resources/css/app.css Normal file
View File

@ -0,0 +1,9 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}

1
resources/js/app.js Normal file
View File

@ -0,0 +1 @@
//

View File

@ -0,0 +1,528 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel - SingleLogin Portal</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: #6366f1;
--accent-secondary: #0078d4;
--text-main: #f3f4f6;
--text-muted: #9ca3af;
--success-color: #10b981;
--error-color: #ef4444;
--info-color: #06b6d4;
}
* {
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;
flex-direction: column;
overflow-x: hidden;
position: relative;
}
/* Glowing background circles */
body::before {
content: '';
position: absolute;
width: 500px;
height: 500px;
border-radius: 50%;
background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
top: -200px;
left: -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;
right: -100px;
z-index: -1;
}
/* Navigation Bar */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 5%;
background: rgba(17, 24, 39, 0.4);
border-bottom: 1px solid var(--card-border);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
z-index: 100;
}
.nav-logo {
font-family: 'Outfit', sans-serif;
font-size: 1.5rem;
font-weight: 800;
background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: flex;
align-items: center;
gap: 8px;
}
.nav-logo svg {
width: 24px;
height: 24px;
fill: #a5b4fc;
}
.nav-actions {
display: flex;
align-items: center;
gap: 12px;
}
.btn-nav {
color: var(--text-muted);
text-decoration: none;
font-size: 0.85rem;
font-weight: 500;
padding: 8px 16px;
border-radius: 8px;
border: 1px solid var(--card-border);
transition: all 0.25s ease;
}
.btn-nav:hover {
color: var(--text-main);
border-color: rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.05);
}
.btn-logout {
color: #ef4444;
border-color: rgba(239, 68, 68, 0.2);
}
.btn-logout:hover {
color: white;
background-color: var(--error-color);
border-color: transparent;
}
/* Dashboard Wrapper */
.dashboard-container {
flex: 1;
padding: 40px 5%;
max-width: 1200px;
width: 100%;
margin: 0 auto;
z-index: 10;
}
/* Welcome Section */
.admin-header {
margin-bottom: 30px;
}
.admin-header h1 {
font-family: 'Outfit', sans-serif;
font-size: 2rem;
font-weight: 700;
margin-bottom: 6px;
}
.admin-header p {
color: var(--text-muted);
font-size: 0.95rem;
}
/* Statistics Cards Grid */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.stat-card {
background-color: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 16px;
padding: 24px;
backdrop-filter: blur(8px);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
display: flex;
align-items: center;
justify-content: space-between;
}
.stat-label {
font-size: 0.8rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 6px;
font-weight: 500;
}
.stat-value {
font-family: 'Outfit', sans-serif;
font-size: 1.8rem;
font-weight: 700;
}
.stat-icon {
font-size: 2rem;
opacity: 0.6;
}
/* Users Management Card */
.users-card {
background-color: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 20px;
padding: 30px;
backdrop-filter: blur(16px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
flex-wrap: wrap;
gap: 12px;
}
.card-title {
font-family: 'Outfit', sans-serif;
font-size: 1.3rem;
font-weight: 600;
}
/* Users Table styling */
.table-responsive {
overflow-x: auto;
width: 100%;
}
.users-table {
width: 100%;
border-collapse: collapse;
text-align: left;
font-size: 0.9rem;
}
.users-table th {
padding: 12px 16px;
border-bottom: 1px solid var(--card-border);
color: var(--text-muted);
font-weight: 600;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.users-table td {
padding: 16px;
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
vertical-align: middle;
}
.users-table tr:last-child td {
border-bottom: none;
}
.user-cell {
display: flex;
align-items: center;
gap: 12px;
}
.user-avatar {
width: 38px;
height: 38px;
border-radius: 50%;
object-fit: cover;
border: 1px solid var(--card-border);
}
.user-avatar-fallback {
width: 38px;
height: 38px;
border-radius: 50%;
background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
color: white;
font-size: 0.95rem;
}
.user-name {
font-weight: 500;
color: var(--text-main);
}
.user-email {
font-size: 0.75rem;
color: var(--text-muted);
}
/* Badges */
.badge {
display: inline-flex;
align-items: center;
padding: 4px 8px;
border-radius: 9999px;
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.badge-admin {
background-color: rgba(99, 102, 241, 0.15);
color: #818cf8;
border: 1px solid rgba(99, 102, 241, 0.3);
}
.badge-user {
background-color: rgba(6, 182, 212, 0.15);
color: var(--info-color);
border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-microsoft {
background-color: rgba(16, 185, 129, 0.12);
color: var(--success-color);
border: 1px solid rgba(16, 185, 129, 0.25);
gap: 4px;
}
.badge-password {
background-color: rgba(245, 158, 11, 0.12);
color: #fbbf24;
border: 1px solid rgba(245, 158, 11, 0.25);
}
.action-btn {
background-color: transparent;
border: 1px solid var(--card-border);
color: var(--text-muted);
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 0.8rem;
transition: all 0.2s ease;
}
.action-btn:hover {
color: var(--text-main);
border-color: rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.05);
}
.microsoft-icon-tiny {
display: inline-grid;
grid-template-columns: 1fr 1fr;
gap: 1px;
width: 10px;
height: 10px;
}
.tiny-rect {
width: 4px;
height: 4px;
}
.tr1 { background-color: #f25022; }
.tr2 { background-color: #7fba00; }
.tr3 { background-color: #00a4ef; }
.tr4 { background-color: #ffb900; }
@media (max-width: 768px) {
.users-card {
padding: 20px 15px;
}
}
</style>
</head>
<body>
<!-- Nav -->
<header class="navbar">
<div class="nav-logo">
<svg viewBox="0 0 24 24">
<path d="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,13C14.67,13 20,14.33 20,17V18H4V17C4,14.33 9.33,13 12,13Z" />
</svg>
SingleLogin Control Panel
</div>
<div class="nav-actions">
<!-- Allow Admin to view the User portal dashboard -->
<a href="{{ route('dashboard') }}" class="btn-nav">
User Dashboard
</a>
<form action="{{ route('logout') }}" method="POST" id="logout-form" style="display: none;">
@csrf
</form>
<a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" class="btn-nav btn-logout">
Sign Out
</a>
</div>
</header>
<!-- Main Container -->
<main class="dashboard-container">
<!-- Header -->
<section class="admin-header">
<h1>System Overview</h1>
<p>Welcome, <strong>{{ $admin->name }}</strong>. Monitoring active directories, credentials, and SSO logins.</p>
</section>
<!-- Stats Grid -->
<section class="stats-grid">
<div class="stat-card">
<div>
<div class="stat-label">Total Registrations</div>
<div class="stat-value">{{ $stats['total_users'] }}</div>
</div>
<div class="stat-icon" style="color: var(--accent-primary);">👥</div>
</div>
<div class="stat-card">
<div>
<div class="stat-label">Administrators</div>
<div class="stat-value">{{ $stats['admins_count'] }}</div>
</div>
<div class="stat-icon" style="color: #818cf8;">🛡️</div>
</div>
<div class="stat-card">
<div>
<div class="stat-label">Microsoft Connected</div>
<div class="stat-value">{{ $stats['microsoft_users'] }}</div>
</div>
<div class="stat-icon" style="color: var(--success-color);">☁️</div>
</div>
<div class="stat-card">
<div>
<div class="stat-label">Local Auth Only</div>
<div class="stat-value">{{ $stats['credentials_users'] }}</div>
</div>
<div class="stat-icon" style="color: #fbbf24;">🔑</div>
</div>
</section>
<!-- Users Table Card -->
<section class="users-card">
<div class="card-header">
<div class="card-title">User Accounts Directory</div>
<div style="font-size: 0.8rem; color: var(--text-muted);">
Showing registered system entities
</div>
</div>
<div class="table-responsive">
<table class="users-table">
<thead>
<tr>
<th>User Account</th>
<th>Assigned Role</th>
<th>Authentication Type</th>
<th>Linked On</th>
<th style="text-align: right;">Operations</th>
</tr>
</thead>
<tbody>
@forelse($users as $usr)
<tr>
<td>
<div class="user-cell">
@if($usr->avatar)
<img src="{{ $usr->avatar }}" alt="{{ $usr->name }}" class="user-avatar">
@else
<div class="user-avatar-fallback">
{{ strtoupper(substr($usr->name, 0, 1)) }}
</div>
@endif
<div>
<div class="user-name">{{ $usr->name }}</div>
<div class="user-email">{{ $usr->email }}</div>
</div>
</div>
</td>
<td>
@if($usr->role === 'admin')
<span class="badge badge-admin">Admin</span>
@else
<span class="badge badge-user">User</span>
@endif
</td>
<td>
@if($usr->microsoft_id)
<span class="badge badge-microsoft">
<div class="microsoft-icon-tiny">
<div class="tiny-rect tr1"></div>
<div class="tiny-rect tr2"></div>
<div class="tiny-rect tr3"></div>
<div class="tiny-rect tr4"></div>
</div>
Microsoft OAuth
</span>
@else
<span class="badge badge-password">Local Password</span>
@endif
</td>
<td>
<span style="font-size: 0.85rem; color: var(--text-muted);">
{{ $usr->created_at ? $usr->created_at->format('Y-m-d H:i') : 'N/A' }}
</span>
</td>
<td style="text-align: right;">
<button class="action-btn" onclick="alert('Management feature toggled for {{ $usr->name }}')">Configure</button>
</td>
</tr>
@empty
<tr>
<td colspan="5" style="text-align: center; color: var(--text-muted); padding: 30px;">
No registered accounts found in the database.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</section>
</main>
<footer style="text-align: center; padding: 40px 0; font-size: 0.75rem; color: var(--text-muted); z-index: 10;">
&copy; 2026 SingleLogin Systems. Authorized Access Only.
</footer>
</body>
</html>

View File

@ -0,0 +1,461 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SingleLogin Portal - Authenticate</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&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;
--error-color: #ef4444;
--success-color: #10b981;
}
* {
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-x: hidden;
position: relative;
}
/* Gorgeous glowing gradient backgrounds */
body::before {
content: '';
position: absolute;
width: 400px;
height: 400px;
border-radius: 50%;
background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
top: -100px;
left: -100px;
z-index: -1;
}
body::after {
content: '';
position: absolute;
width: 500px;
height: 500px;
border-radius: 50%;
background: radial-gradient(circle, rgba(0, 120, 212, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
bottom: -150px;
right: -150px;
z-index: -1;
}
.login-container {
width: 100%;
max-width: 460px;
padding: 20px;
z-index: 10;
}
.brand-header {
text-align: center;
margin-bottom: 24px;
}
.brand-logo {
font-family: 'Outfit', sans-serif;
font-size: 2.2rem;
font-weight: 800;
background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
letter-spacing: -0.5px;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.brand-logo svg {
width: 32px;
height: 32px;
fill: #38bdf8;
}
.brand-subtitle {
font-size: 0.9rem;
color: var(--text-muted);
margin-top: 6px;
}
/* Glassmorphism Card styling */
.login-card {
background-color: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 20px;
padding: 40px 32px;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-card:hover {
box-shadow: 0 15px 40px rgba(79, 70, 229, 0.1);
}
/* Portal Toggle Tabs */
.portal-tabs {
display: flex;
background-color: rgba(255, 255, 255, 0.04);
border-radius: 12px;
padding: 4px;
margin-bottom: 30px;
border: 1px solid rgba(255, 255, 255, 0.05);
}
.tab-btn {
flex: 1;
padding: 10px;
border: none;
background: none;
color: var(--text-muted);
font-family: 'Inter', sans-serif;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
border-radius: 8px;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-btn.active {
background-color: var(--accent-primary);
color: var(--text-main);
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: fadeIn 0.4s ease-out;
}
/* Typography & Forms */
h2 {
font-family: 'Outfit', sans-serif;
font-weight: 600;
font-size: 1.4rem;
margin-bottom: 8px;
}
.portal-desc {
font-size: 0.85rem;
color: var(--text-muted);
margin-bottom: 24px;
line-height: 1.4;
}
.form-group {
margin-bottom: 20px;
position: relative;
}
.form-label {
display: block;
font-size: 0.8rem;
color: var(--text-muted);
margin-bottom: 8px;
font-weight: 500;
letter-spacing: 0.5px;
text-transform: uppercase;
}
.form-input {
width: 100%;
padding: 12px 16px;
background-color: rgba(255, 255, 255, 0.04);
border: 1px solid var(--card-border);
border-radius: 10px;
color: var(--text-main);
font-family: 'Inter', sans-serif;
font-size: 0.95rem;
transition: all 0.3s ease;
}
.form-input:focus {
outline: none;
border-color: var(--accent-primary);
background-color: rgba(255, 255, 255, 0.07);
box-shadow: 0 0 10px rgba(79, 70, 229, 0.15);
}
/* Buttons */
.btn {
width: 100%;
padding: 13px;
border-radius: 10px;
border: none;
font-family: 'Inter', sans-serif;
font-weight: 600;
font-size: 0.95rem;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.btn-primary {
background-color: var(--accent-primary);
color: var(--text-main);
}
.btn-primary:hover {
background-color: #4338ca;
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(79, 70, 229, 0.3);
}
.btn-microsoft {
background-color: #2f2f2f;
border: 1px solid rgba(255, 255, 255, 0.1);
color: var(--text-main);
font-weight: 500;
}
.btn-microsoft:hover {
background-color: #3f3f3f;
border-color: rgba(255, 255, 255, 0.2);
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}
.microsoft-icon-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2px;
width: 16px;
height: 16px;
}
.micro-rect {
width: 7px;
height: 7px;
}
.r1 { background-color: #f25022; }
.r2 { background-color: #7fba00; }
.r3 { background-color: #00a4ef; }
.r4 { background-color: #ffb900; }
/* Notification Alerts */
.alert {
border-radius: 10px;
padding: 12px 16px;
margin-bottom: 20px;
font-size: 0.85rem;
line-height: 1.4;
display: flex;
align-items: flex-start;
gap: 10px;
}
.alert-danger {
background-color: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.2);
color: var(--error-color);
}
.alert-success {
background-color: rgba(16, 185, 129, 0.1);
border: 1px solid rgba(16, 185, 129, 0.2);
color: var(--success-color);
}
.alert-icon {
font-size: 1.1rem;
line-height: 1;
}
/* Divider */
.divider {
display: flex;
align-items: center;
text-align: center;
color: var(--text-muted);
font-size: 0.8rem;
margin: 20px 0;
}
.divider::before, .divider::after {
content: '';
flex: 1;
border-bottom: 1px solid var(--card-border);
}
.divider:not(:empty)::before {
margin-right: .5em;
}
.divider:not(:empty)::after {
margin-left: .5em;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.footer {
text-align: center;
margin-top: 24px;
font-size: 0.75rem;
color: var(--text-muted);
}
</style>
</head>
<body>
<div class="login-container">
<div class="brand-header">
<div class="brand-logo">
<svg viewBox="0 0 24 24">
<path d="M18,8H17V6A5,5 0 0,0 12,1A5,5 0 0,0 7,6V8H6A2,2 0 0,0 4,10V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V10A2,2 0 0,0 18,8M8.9,6C8.9,4.29 10.29,2.9 12,2.9C13.71,2.9 15.1,4.29 15.1,6V8H8.9V6M12,17A2,2 0 1,1 14,15A2,2 0 0,1 12,17Z" />
</svg>
SingleLogin
</div>
<div class="brand-subtitle">Unified Identity Authentication Portal</div>
</div>
<div class="login-card">
<!-- Alert Display -->
@if(session('error'))
<div class="alert alert-danger">
<span class="alert-icon">⚠️</span>
<div>{{ session('error') }}</div>
</div>
@endif
@if(session('success'))
<div class="alert alert-success">
<span class="alert-icon"></span>
<div>{{ session('success') }}</div>
</div>
@endif
@if($errors->any())
<div class="alert alert-danger">
<span class="alert-icon">⚠️</span>
<div>
@foreach($errors->all() as $error)
<p>{{ $error }}</p>
@endforeach
</div>
</div>
@endif
<!-- Portal Tabs -->
<div class="portal-tabs">
<button type="button" class="tab-btn active" onclick="switchPortal('user')">User Portal</button>
<button type="button" class="tab-btn" onclick="switchPortal('admin')">Admin Portal</button>
</div>
<!-- User Portal Tab -->
<div id="user-portal" class="tab-content active">
<h2>Welcome back</h2>
<div class="portal-desc">Access your Microsoft 365 services and corporate resources. Users must sign in via Single Sign-On.</div>
<a href="{{ route('auth.microsoft.redirect') }}" class="btn btn-microsoft" style="text-decoration: none;">
<div class="microsoft-icon-grid">
<div class="micro-rect r1"></div>
<div class="micro-rect r2"></div>
<div class="micro-rect r3"></div>
<div class="micro-rect r4"></div>
</div>
Sign in with Microsoft
</a>
</div>
<!-- Admin Portal Tab -->
<div id="admin-portal" class="tab-content">
<h2>Admin Login</h2>
<div class="portal-desc">Manage tenant configurations, user assignments, and systems.</div>
<!-- Email/Password Admin Form -->
<form action="{{ route('login.admin') }}" method="POST">
@csrf
<div class="form-group">
<label class="form-label" for="email">Admin Email</label>
<input type="email" id="email" name="email" class="form-input" placeholder="admin@company.com" required value="{{ old('email') }}">
</div>
<div class="form-group">
<label class="form-label" for="password">Password</label>
<input type="password" id="password" name="password" class="form-input" placeholder="••••••••" required>
</div>
<button type="submit" class="btn btn-primary" style="margin-bottom: 10px;">
Login as Administrator
</button>
</form>
<div class="divider">or</div>
<!-- Microsoft Login Alternative for Admin -->
<a href="{{ route('auth.microsoft.redirect') }}" class="btn btn-microsoft" style="text-decoration: none;">
<div class="microsoft-icon-grid">
<div class="micro-rect r1"></div>
<div class="micro-rect r2"></div>
<div class="micro-rect r3"></div>
<div class="micro-rect r4"></div>
</div>
Sign in with Microsoft
</a>
</div>
</div>
<div class="footer">
&copy; 2026 SingleLogin Systems. Secured with Microsoft Identity Platform.
</div>
</div>
<script>
function switchPortal(portal) {
// Remove active classes
document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
// Add active classes
if (portal === 'user') {
document.querySelector('.tab-btn:nth-child(1)').classList.add('active');
document.getElementById('user-portal').classList.add('active');
} else {
document.querySelector('.tab-btn:nth-child(2)').classList.add('active');
document.getElementById('admin-portal').classList.add('active');
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,621 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - SingleLogin Portal</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;
--success-color: #10b981;
--info-color: #06b6d4;
}
* {
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;
flex-direction: column;
overflow-x: 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.12) 0%, rgba(0, 0, 0, 0) 70%);
top: -200px;
right: -100px;
z-index: -1;
}
body::after {
content: '';
position: absolute;
width: 400px;
height: 400px;
border-radius: 50%;
background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
bottom: -100px;
left: -100px;
z-index: -1;
}
/* Navigation Bar */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 5%;
background: rgba(17, 24, 39, 0.4);
border-bottom: 1px solid var(--card-border);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
z-index: 100;
}
.nav-logo {
font-family: 'Outfit', sans-serif;
font-size: 1.5rem;
font-weight: 800;
background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: flex;
align-items: center;
gap: 8px;
}
.nav-logo svg {
width: 24px;
height: 24px;
fill: #38bdf8;
}
.nav-user {
display: flex;
align-items: center;
gap: 12px;
}
.logout-link {
color: var(--text-muted);
text-decoration: none;
font-size: 0.85rem;
font-weight: 500;
padding: 8px 16px;
border-radius: 8px;
border: 1px solid var(--card-border);
transition: all 0.25s ease;
}
.logout-link:hover {
color: #ef4444;
border-color: rgba(239, 68, 68, 0.2);
background-color: rgba(239, 68, 68, 0.05);
}
/* Dashboard Wrapper */
.dashboard-container {
flex: 1;
padding: 40px 5%;
max-width: 1200px;
width: 100%;
margin: 0 auto;
z-index: 10;
}
/* Profile Banner Widget */
.profile-card {
background-color: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 20px;
padding: 30px;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 20px;
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
margin-bottom: 40px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
.profile-info {
display: flex;
align-items: center;
gap: 20px;
}
.profile-avatar-container {
position: relative;
}
.profile-avatar {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
border: 3px solid var(--accent-primary);
box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}
.profile-avatar-fallback {
width: 80px;
height: 80px;
border-radius: 50%;
background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: 700;
color: white;
box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
}
.profile-details h1 {
font-family: 'Outfit', sans-serif;
font-size: 1.8rem;
font-weight: 700;
margin-bottom: 4px;
}
.profile-email {
color: var(--text-muted);
font-size: 0.95rem;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 6px;
}
.badge {
display: inline-flex;
align-items: center;
padding: 4px 10px;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.badge-user {
background-color: rgba(6, 182, 212, 0.15);
color: var(--info-color);
border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-sso {
background-color: rgba(16, 185, 129, 0.15);
color: var(--success-color);
border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-admin {
background-color: rgba(99, 102, 241, 0.15);
color: #818cf8;
border: 1px solid rgba(99, 102, 241, 0.3);
}
.session-status {
text-align: right;
}
.status-pill {
font-size: 0.85rem;
color: var(--text-muted);
background-color: rgba(255, 255, 255, 0.03);
padding: 8px 16px;
border-radius: 12px;
border: 1px solid var(--card-border);
display: inline-flex;
align-items: center;
gap: 8px;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background-color: var(--success-color);
box-shadow: 0 0 10px var(--success-color);
}
/* Services Grid */
.section-title {
font-family: 'Outfit', sans-serif;
font-size: 1.4rem;
font-weight: 700;
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 10px;
}
.section-title::after {
content: '';
flex: 1;
height: 1px;
background: linear-gradient(to right, var(--card-border), transparent);
}
.services-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 24px;
}
/* Service Cards */
.service-card {
background-color: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 16px;
padding: 28px;
cursor: pointer;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
backdrop-filter: blur(8px);
}
.service-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background-color: transparent;
transition: background-color 0.3s ease;
}
.service-card:hover {
transform: translateY(-5px);
border-color: rgba(255, 255, 255, 0.15);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.service-icon-wrapper {
width: 54px;
height: 54px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
transition: transform 0.3s ease;
}
.service-card:hover .service-icon-wrapper {
transform: scale(1.1) rotate(3deg);
}
.service-icon-wrapper svg {
width: 32px;
height: 32px;
}
.service-tag {
align-self: flex-start;
font-size: 0.75rem;
color: var(--text-muted);
background-color: rgba(255, 255, 255, 0.04);
padding: 2px 8px;
border-radius: 4px;
margin-bottom: 8px;
font-weight: 500;
}
.service-name {
font-family: 'Outfit', sans-serif;
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 8px;
}
.service-desc {
font-size: 0.85rem;
color: var(--text-muted);
line-height: 1.5;
margin-bottom: 24px;
}
.sso-launch-btn {
background-color: rgba(255, 255, 255, 0.04);
border: 1px solid var(--card-border);
color: var(--text-main);
padding: 8px 12px;
border-radius: 8px;
font-size: 0.85rem;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
width: 100%;
transition: all 0.2s ease;
}
.service-card:hover .sso-launch-btn {
background-color: var(--accent-primary);
border-color: transparent;
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
/* Fullscreen SSO Modal Overlay */
.sso-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(11, 15, 25, 0.85);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
opacity: 0;
pointer-events: none;
transition: opacity 0.35s ease;
}
.sso-modal.active {
opacity: 1;
pointer-events: all;
}
.sso-modal-card {
background-color: rgba(25, 30, 45, 0.7);
border: 1px solid var(--card-border);
border-radius: 20px;
padding: 40px;
text-align: center;
max-width: 450px;
width: 90%;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
transform: scale(0.9);
transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sso-modal.active .sso-modal-card {
transform: scale(1);
}
.sso-loader {
position: relative;
width: 80px;
height: 80px;
margin: 0 auto 30px;
}
.sso-spinner {
box-sizing: border-box;
display: block;
position: absolute;
width: 80px;
height: 80px;
border: 4px solid transparent;
border-radius: 50%;
animation: sso-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-top-color: var(--accent-secondary);
}
.sso-spinner-inner {
box-sizing: border-box;
display: block;
position: absolute;
width: 64px;
height: 64px;
margin: 8px;
border: 4px solid transparent;
border-radius: 50%;
animation: sso-spin-reverse 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-top-color: var(--accent-primary);
}
.sso-title {
font-family: 'Outfit', sans-serif;
font-size: 1.4rem;
font-weight: 700;
margin-bottom: 12px;
background: linear-gradient(135deg, #a5b4fc 0%, #38bdf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.sso-subtitle {
font-size: 0.85rem;
color: var(--text-muted);
line-height: 1.5;
}
@keyframes sso-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes sso-spin-reverse {
0% { transform: rotate(0deg); }
100% { transform: rotate(-360deg); }
}
@media (max-width: 768px) {
.profile-card {
flex-direction: column;
align-items: flex-start;
padding: 24px;
}
.session-status {
text-align: left;
width: 100%;
}
}
</style>
</head>
<body>
<!-- Nav -->
<header class="navbar">
<div class="nav-logo">
<svg viewBox="0 0 24 24">
<path d="M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20Z" />
</svg>
SingleLogin Dashboard
</div>
<div class="nav-user">
@if($user->role === 'admin')
<a href="{{ route('admin.dashboard') }}" class="logout-link" style="color: var(--info-color); border-color: rgba(6, 182, 212, 0.2); background-color: rgba(6, 182, 212, 0.05); margin-right: 10px;">
Admin Panel
</a>
@endif
<form action="{{ route('logout') }}" method="POST" id="logout-form" style="display: none;">
@csrf
</form>
<a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" class="logout-link">
Sign Out
</a>
</div>
</header>
<!-- Main Container -->
<main class="dashboard-container">
<!-- User Welcome / Profile Card -->
<section class="profile-card">
<div class="profile-info">
<div class="profile-avatar-container">
@if($user->avatar)
<img src="{{ $user->avatar }}" alt="{{ $user->name }}" class="profile-avatar">
@else
<div class="profile-avatar-fallback">
{{ strtoupper(substr($user->name, 0, 1)) }}
</div>
@endif
</div>
<div class="profile-details">
<h1>Welcome, {{ $user->name }}</h1>
<div class="profile-email">
<span>{{ $user->email }}</span>
&bull;
<span class="badge badge-user">{{ $user->role }}</span>
@if($user->microsoft_id)
<span class="badge badge-sso">Microsoft Linked</span>
@endif
</div>
</div>
</div>
<div class="session-status">
<div class="status-pill">
<span class="status-dot"></span>
<span>Secure Microsoft SSO Session Active</span>
</div>
</div>
</section>
<!-- Services Section -->
<section>
<h2 class="section-title">Authorized Corporate Services</h2>
<div class="services-grid">
@foreach($services as $service)
<div class="service-card" onclick="launchSSO('{{ $service['name'] }}', '{{ $service['url'] }}')" style="border-top: 4px solid {{ $service['color'] }}">
<div>
<div class="service-tag">{{ $service['tag'] }}</div>
<div class="service-icon-wrapper" style="background-color: rgba({{ hexdec(substr($service['color'], 1, 2)) }}, {{ hexdec(substr($service['color'], 3, 2)) }}, {{ hexdec(substr($service['color'], 5, 2)) }}, 0.08)">
<!-- Custom SVGs for Service Providers -->
@if($service['icon_svg'] === 'outlook')
<svg viewBox="0 0 24 24" fill="{{ $service['color'] }}">
<path d="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,19H5V8H19V19M19,6H5V5H19V6M17,12H12V17H17V12Z" />
</svg>
@elseif($service['icon_svg'] === 'teams')
<svg viewBox="0 0 24 24" fill="{{ $service['color'] }}">
<path d="M12.5,9A2.5,2.5 0 0,1 15,11.5A2.5,2.5 0 0,1 12.5,14A2.5,2.5 0 0,1 10,11.5A2.5,2.5 0 0,1 12.5,9M12.5,15.5C14.71,15.5 18.5,16.5 18.5,18.5V20H6.5V18.5C6.5,16.5 10.29,15.5 12.5,15.5M6,8A2,2 0 0,1 8,10A2,2 0 0,1 6,12A2,2 0 0,1 4,10A2,2 0 0,1 6,8M6,13.5C7.43,13.5 10,14.07 10,15.25V17H2V15.25C2,14.07 4.57,13.5 6,13.5M12.5,3A2,2 0 0,1 14.5,5A2,2 0 0,1 12.5,7A2,2 0 0,1 10.5,5A2,2 0 0,1 12.5,3M12.5,20V22H19V20H12.5Z" />
</svg>
@else
<svg viewBox="0 0 24 24" fill="{{ $service['color'] }}">
<path d="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M12,6A6,6 0 0,0 6,12A6,6 0 0,0 12,18A6,6 0 0,0 18,12A6,6 0 0,0 12,6M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8Z" />
</svg>
@endif
</div>
<div class="service-name">{{ $service['name'] }}</div>
<div class="service-desc">{{ $service['desc'] }}</div>
</div>
<button class="sso-launch-btn">
Launch Service
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3"/>
</svg>
</button>
</div>
@endforeach
</div>
</section>
</main>
<!-- SSO Interstitial Loading Modal -->
<div id="sso-modal" class="sso-modal">
<div class="sso-modal-card">
<div class="sso-loader">
<div class="sso-spinner"></div>
<div class="sso-spinner-inner"></div>
</div>
<div class="sso-title" id="sso-modal-title">Signing into Service</div>
<div class="sso-subtitle">
Negotiating single sign-on token with Microsoft Identity Server...<br>
Connecting securely. You will be redirected silently.
</div>
</div>
</div>
<script>
function launchSSO(serviceName, url) {
const modal = document.getElementById('sso-modal');
const modalTitle = document.getElementById('sso-modal-title');
modalTitle.innerText = `Connecting to ${serviceName}`;
modal.classList.add('active');
// Artificial delay of 1.2s to visually represent and simulate the Microsoft session SSO handshake,
// then open in a new tab silently.
setTimeout(() => {
modal.classList.remove('active');
window.open(url, '_blank');
}, 1200);
}
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

8
routes/console.php Normal file
View File

@ -0,0 +1,8 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

27
routes/web.php Normal file
View File

@ -0,0 +1,27 @@
<?php
use App\Http\Controllers\AdminController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\LoginController;
use Illuminate\Support\Facades\Route;
// Authentication & Portal landing
Route::get('/', [LoginController::class, 'showLoginForm']);
Route::get('/login', [LoginController::class, 'showLoginForm'])->name('login');
Route::post('/login/admin', [LoginController::class, 'adminLogin'])->name('login.admin');
Route::post('/logout', [LoginController::class, 'logout'])->name('logout');
Route::get('/logout', [LoginController::class, 'logout']); // For ease of development/testing via GET
// Microsoft OAuth endpoints
Route::get('/auth/microsoft/redirect', [LoginController::class, 'redirectToMicrosoft'])->name('auth.microsoft.redirect');
Route::get('/auth/microsoft/callback', [LoginController::class, 'handleMicrosoftCallback'])->name('auth.microsoft.callback');
// User Dashboard Portal (requires standard user role)
Route::middleware(['auth', 'role:user'])->group(function () {
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
});
// Admin Control Panel (requires admin role)
Route::middleware(['auth', 'role:admin'])->group(function () {
Route::get('/admin/dashboard', [AdminController::class, 'index'])->name('admin.dashboard');
});

4
storage/app/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!private/
!public/
!.gitignore

2
storage/app/private/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/app/public/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

9
storage/framework/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json

3
storage/framework/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!data/
!.gitignore

View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/sessions/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/testing/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/framework/views/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

2
storage/logs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -0,0 +1,19 @@
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->get('/');
$response->assertStatus(200);
}
}

10
tests/TestCase.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
//
}

View File

@ -0,0 +1,16 @@
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}

24
vite.config.js Normal file
View File

@ -0,0 +1,24 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { bunny } from 'laravel-vite-plugin/fonts';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
fonts: [
bunny('Instrument Sans', {
weights: [400, 500, 600],
}),
],
}),
tailwindcss(),
],
server: {
watch: {
ignored: ['**/storage/framework/views/**'],
},
},
});