namespace App\Http\Controllers;
use App\Models\Client;
+use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
protected function auth()
{
- return response((!auth()->guest()) ? '1' : '0')->header('Content-Type', 'text/plain');
+ return response((!Auth::guard('client')->guest()) ? '1' : '0')->header('Content-Type', 'text/plain');
}
protected function login()
$path = 'index.html';
}
+ if ($path === 'index.html' && !Auth::guard('client')->guest()) {
+ $path = 'home-logged.html';
+ }
+
$relayPath = resource_path('webflow') . '/' . $path;
if (str_ends_with($path, '.html')) {
$html = file_get_contents($relayPath);
'password' => ['required'],
]);
- if (Auth::attempt($credentials)) {
+ if (Auth::guard('client')->attempt($credentials)) {
$request->session()->regenerate();
- return redirect()->intended('dashboard');
+ return redirect('/');
}
return back();
}
+ public function logout()
+ {
+ Auth::guard('client')->logout();
+ return back();
+ }
+
}
use App\Http\Controllers\Operations\Client\Landing;
use Cubist\Backpack\Magic\Fields\Text;
use Cubist\Backpack\Magic\Models\CubistMagicAuthenticatable;
+use Illuminate\Support\Facades\Password;
class Client extends CubistMagicAuthenticatable
{
parent::setFields();
$this->getField('enabled')->setAttribute('label', 'Activé');
+ $this->getField('password')->setAttribute('can', null);
$this->addField('finess', Text::class, 'Numéro FINESS', ['tab' => 'Login']);
$this->addField('hospital', Text::class, 'Nom de l\'établissement', ['tab' => 'Login']);
$this->addField('firstname', Text::class, 'Prénom', ['tab' => 'Login']);
'driver' => 'session',
'provider' => 'users',
],
+ 'client' => [
+ 'driver' => 'session',
+ 'provider' => 'clients',
+ ],
],
/*
'providers' => [
'users' => [
+ 'driver' => 'eloquent',
+ 'model' => App\Models\User::class,
+ ],
+
+ 'clients' => [
'driver' => 'eloquent',
'model' => App\Models\Client::class,
],
'expire' => 60,
'throttle' => 60,
],
+
+ 'clients' => [
+ 'provider' => 'clients',
+ 'table' => 'password_reset_tokens',
+ 'expire' => 60,
+ 'throttle' => 60,
+ ],
'backpack' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
--- /dev/null
+<a href="/catalogue/">Voir le catalogue</a>
+++ /dev/null
-<?php
-
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Route;
-
-/*
-|--------------------------------------------------------------------------
-| API Routes
-|--------------------------------------------------------------------------
-|
-| Here is where you can register API routes for your application. These
-| routes are loaded by the RouteServiceProvider and all of them will
-| be assigned to the "api" middleware group. Make something great!
-|
-*/
-
-Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
- return $request->user();
-});
+++ /dev/null
-<?php
-
-use Illuminate\Support\Facades\Broadcast;
-
-/*
-|--------------------------------------------------------------------------
-| Broadcast Channels
-|--------------------------------------------------------------------------
-|
-| Here you may register all of the event broadcasting channels that your
-| application supports. The given channel authorization callbacks are
-| used to check if an authenticated user can listen to the channel.
-|
-*/
-
-Broadcast::channel('App.Models.User.{id}', function (bastide-resah, $id) {
- return (int) bastide-resah->id === (int) $id;
-});
+++ /dev/null
-<?php
-
-use Illuminate\Foundation\Inspiring;
-use Illuminate\Support\Facades\Artisan;
-
-/*
-|--------------------------------------------------------------------------
-| Console Routes
-|--------------------------------------------------------------------------
-|
-| This file is where you may define all of your Closure based console
-| commands. Each Closure is bound to a command instance allowing a
-| simple approach to interacting with each command's IO methods.
-|
-*/
-
-Artisan::command('inspire', function () {
- $this->comment(Inspiring::quote());
-})->purpose('Display an inspiring quote');
<?php
-use App\Http\Middleware\CheckIfAdmin;
use App\Http\Middleware\VerifyCsrfToken;
use Illuminate\Support\Facades\Route;
+
Route::get('/catalogue/{path?}', \App\Http\Controllers\CatalogController::class . '@index')->where('path', '.*');
Route::get('/catalogue_invite/{path?}', \App\Http\Controllers\CatalogController::class . '@guest')->where('path', '.*');
-//Route::get('/{path?}', \App\Http\Controllers\LandingController::class . '@catchall')->where('path', '.*');
-Route::match(['post'], '/fluidbook/signin', \App\Http\Controllers\FluidbookController::class . '@signin')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
-Route::match(['post'], '/fluidbook/login', \App\Http\Controllers\FluidbookController::class . '@login')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
-Route::match(['post'], '/fluidbook/forgotpassword', \App\Http\Controllers\FluidbookController::class . '@forgotPAssword')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
-Route::match(['get'], '/fluidbook/auth', \App\Http\Controllers\FluidbookController::class . '@auth')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
+Route::match(['post'], '/fluidbook/signin', \App\Http\Controllers\FluidbookController::class . '@signin')->withoutMiddleware([VerifyCsrfToken::class]);
+Route::match(['post'], '/fluidbook/login', \App\Http\Controllers\FluidbookController::class . '@login')->withoutMiddleware([VerifyCsrfToken::class]);
+Route::match(['post'], '/fluidbook/forgotpassword', \App\Http\Controllers\FluidbookController::class . '@forgotPAssword')->withoutMiddleware([VerifyCsrfToken::class]);
+Route::match(['get'], '/fluidbook/auth', \App\Http\Controllers\FluidbookController::class . '@auth');
+
+Route::match(['post'], '/landing/signin', \App\Http\Controllers\LandingController::class . '@signin');
+Route::match(['post'], '/landing/login', \App\Http\Controllers\LandingController::class . '@login');
+Route::match(['post'], '/landing/forgotpassword', \App\Http\Controllers\LandingController::class . '@forgotPassword');
-Route::match(['post'], '/landing/signin', \App\Http\Controllers\LandingController::class . '@signin')->withoutMiddleware([CheckIfAdmin::class]);
-Route::match(['post'], '/landing/login', \App\Http\Controllers\LandingController::class . '@login')->withoutMiddleware([CheckIfAdmin::class]);
-Route::match(['post'], '/landing/forgotpassword', \App\Http\Controllers\LandingController::class . '@forgotPassword')->withoutMiddleware([CheckIfAdmin::class]);
+Route::get('/{path?}', \App\Http\Controllers\LandingController::class . '@catchall')->where('path', '.*');