}
}
+ protected function auth()
+ {
+ return response((!auth()->guest()) ? '1' : '0')->header('Content-Type', 'text/plain');
+ }
+
protected function login()
{
//
namespace App\Http\Controllers;
use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
+use Illuminate\Support\Facades\Auth;
class LandingController extends Controller
{
}
$relayPath = resource_path('webflow') . '/' . $path;
- if (str_ends_with( $path,'.html')) {
+ if (str_ends_with($path, '.html')) {
$html = file_get_contents($relayPath);
$html = str_replace('</head>', '<meta name="csrf-token" content="' . csrf_token() . '"/></head>', $html);
return response($html)->header('Content-Type', 'text/html');
return XSendFileController::sendfile($relayPath);
}
+
+ public function login()
+ {
+ $request = request();
+ $credentials = $request->validate([
+ 'email' => ['required', 'email'],
+ 'password' => ['required'],
+ ]);
+
+ if (Auth::attempt($credentials)) {
+ $request->session()->regenerate();
+ return redirect()->intended('dashboard');
+ }
+
+ return back();
+ }
+
}
'providers' => [
'users' => [
'driver' => 'eloquent',
- 'model' => App\Models\User::class,
+ 'model' => App\Models\Client::class,
],
'backpack' => [
$(function () {
- $('#wf-form-login').on('submit', function (e) {
- $.ajax(
- {
- url: $(this).attr('action'),
- method: "POST",
- data: $(this).serialize(),
- dataType: 'json',
- success: function (data) {
-
- }
- });
- return false;
- });
+ console.log($('meta[name="csrf-token"]'));
+ $('#wf-form-login').attr('action', '/landing/login');
+ $("#wf-form-login").append('<input type="hidden" name="_token" value="' + $('meta[name="csrf-token"]').attr('content') + '" />');
});
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::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'], '/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]);