]> _ Git - bastide-resah.git/commitdiff
wip #6872 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 19 Apr 2024 08:45:19 +0000 (10:45 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 19 Apr 2024 08:45:19 +0000 (10:45 +0200)
app/Http/Controllers/Admin/ClientCrudController.php
app/Http/Controllers/FluidbookController.php [new file with mode: 0644]
app/Http/Controllers/LandingController.php [new file with mode: 0644]
app/Http/Controllers/Operations/Client/Fluidbook.php [deleted file]
app/Http/Controllers/WebflowController.php [deleted file]
app/Models/Client.php
resources/webflow/charte-de-protection-des-donnees-personnelles.html
resources/webflow/index.html
resources/webflow/js/custom.js
resources/webflow/mentions-legales.html
routes/web.php

index 1376ba9ad4e959b73e15e9d3c6350264a4486c92..481d3f039238edabb797bcbaada28aa60c68e695 100644 (file)
@@ -13,7 +13,6 @@ class ClientCrudController extends \Cubist\Backpack\Magic\Controllers\CubistMagi
        use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
        use \Backpack\CRUD\app\Http\Controllers\Operations\BulkDeleteOperation;
        use \Cubist\Backpack\Http\Controllers\Operations\ReviseOperation;
-       use \App\Http\Controllers\Operations\Client\Fluidbook;
        
 
 
diff --git a/app/Http/Controllers/FluidbookController.php b/app/Http/Controllers/FluidbookController.php
new file mode 100644 (file)
index 0000000..6055e34
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\Client;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Validator;
+
+class FluidbookController extends Controller
+{
+    protected function signin()
+    {
+        $validator = Validator::make(request()->all(), [
+            'finess' => 'required|regex:/^[0-9]{9}$/',
+            'password' => 'required|confirmed|min:8',
+            'hospital' => 'required',
+            'firstname' => 'required',
+            'name' => 'required',
+            'function' => 'required',
+            'phone' => 'required|regex:/^0[0-9]{9}$/',
+            'email' => 'required|confirmed|unique:App\Models\Client,email',
+        ]);
+
+        if ($validator->fails()) {
+            return response()->setStatusCode(422)->json(['errors' => $validator->errors()]);
+        } else {
+
+            $client = new Client();
+            foreach ($validator->valid() as $k => $v) {
+                if ($k === 'password') {
+                    $client->$k = Hash::make($v);
+                } else {
+                    $client->$k = $v;
+                }
+            }
+            $client->enabled = false;
+            $client->save();
+
+            return response()->setStatusCode(200)->json(['success' => 'ok']);
+
+        }
+    }
+
+    protected function login()
+    {
+//
+    }
+
+    protected function forgotpassword()
+    {
+        //
+    }
+}
diff --git a/app/Http/Controllers/LandingController.php b/app/Http/Controllers/LandingController.php
new file mode 100644 (file)
index 0000000..7b0c15f
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
+
+class LandingController extends Controller
+{
+    public function catchall($path = '')
+    {
+        if (!$path) {
+            $path = 'index.html';
+        }
+
+        $relayPath = resource_path('webflow') . '/' . $path;
+        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);
+    }
+}
diff --git a/app/Http/Controllers/Operations/Client/Fluidbook.php b/app/Http/Controllers/Operations/Client/Fluidbook.php
deleted file mode 100644 (file)
index 756b48e..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Operations\Client;
-
-use App\Http\Middleware\CheckIfAdmin;
-use App\Http\Middleware\VerifyCsrfToken;
-use App\Models\Client;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Password;
-use Illuminate\Support\Facades\Route;
-use Illuminate\Support\Facades\Validator;
-
-trait Fluidbook
-{
-    protected function setupFluidbookRoutes($segment, $routeName, $controller)
-    {
-        Route::match(['post'], $segment . '/signin', $controller . '@signin')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
-        Route::match(['post'], $segment . '/login', $controller . '@login')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
-        Route::match(['post'], $segment . '/forgotpassword', $controller . '@login')->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]);
-    }
-
-    protected function signin()
-    {
-        $validator = Validator::make(request()->all(), [
-            'finess' => 'required|regex:/^[0-9]{9}$/',
-            'password' => 'required|confirmed|min:8',
-            'hospital' => 'required',
-            'firstname' => 'required',
-            'name' => 'required',
-            'function' => 'required',
-            'phone' => 'required|regex:/^0[0-9]{9}$/',
-            'email' => 'required|confirmed|unique:App\Models\Client,email',
-        ]);
-
-        if ($validator->fails()) {
-            return response()->setStatusCode(422)->json(['errors' => $validator->errors()]);
-        } else {
-
-            $client = new Client();
-            foreach ($validator->valid() as $k => $v) {
-                if ($k === 'password') {
-                    $client->$k = Hash::make($v);
-                } else {
-                    $client->$k = $v;
-                }
-            }
-            $client->enabled = false;
-            $client->save();
-
-            return response()->setStatusCode(200)->json(['success' => 'ok']);
-
-        }
-    }
-
-    protected function login()
-    {
-//
-    }
-
-    protected function forgotpassword()
-    {
-        //
-    }
-}
diff --git a/app/Http/Controllers/WebflowController.php b/app/Http/Controllers/WebflowController.php
deleted file mode 100644 (file)
index d143667..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
-
-class WebflowController extends Controller
-{
-    public function catchall($path = '')
-    {
-        if (!$path) {
-            $path = 'index.html';
-        }
-
-        $relayPath = resource_path('webflow') . '/' . $path;
-        if($path!=='index.html'){
-           // dd($relayPath);
-        }
-
-        return XSendFileController::sendfile($relayPath);
-    }
-}
index 12d466f92fd9cb030e6899f36f4f207a7fcf1139..b4b4cb00ac2d937abd7df2f7f01f3ac55ad69c13 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\Models;
 
 use App\Http\Controllers\Operations\Client\Fluidbook;
+use App\Http\Controllers\Operations\Client\Landing;
 use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Backpack\Magic\Models\CubistMagicAuthenticatable;
 
@@ -13,8 +14,6 @@ class Client extends CubistMagicAuthenticatable
         'singular' => 'client',
         'plural' => 'clients'];
 
-    protected $_operations = [Fluidbook::class];
-
     public function setFields()
     {
         parent::setFields();
@@ -26,6 +25,5 @@ class Client extends CubistMagicAuthenticatable
         $this->addField('name', Text::class, 'Nom', ['tab' => 'Login']);
         $this->addField('function', Text::class, 'Fonction', ['tab' => 'Login']);
         $this->addField('phone', Text::class, 'Numéro de téléphone', ['tab' => 'Login']);
-
     }
 }
index 3eaa239395b013ed547e5e9dffb9445ab43c550c..3195b391788a37f1243d94650c11edd067263f99 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html><!--  This site was created in Webflow. https://www.webflow.com  -->
-<!--  Last Published: Thu Apr 18 2024 18:05:34 GMT+0000 (Coordinated Universal Time)  -->
+<!--  Last Published: Fri Apr 19 2024 08:21:02 GMT+0000 (Coordinated Universal Time)  -->
 <html data-wf-page="6620dda3b5f5da5125581eb0" data-wf-site="661004d856d8b276759afc40">
 <head>
   <meta charset="utf-8">
index ca83034b7b67cb158346519bbd1631c145822cc5..de43b54a9fe6603cec3837a292389b270c11f9ad 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html><!--  This site was created in Webflow. https://www.webflow.com  -->
-<!--  Last Published: Thu Apr 18 2024 18:05:34 GMT+0000 (Coordinated Universal Time)  -->
+<!--  Last Published: Fri Apr 19 2024 08:21:02 GMT+0000 (Coordinated Universal Time)  -->
 <html data-wf-page="661004d856d8b276759afc4f" data-wf-site="661004d856d8b276759afc40">
 <head>
   <meta charset="utf-8">
@@ -39,7 +39,7 @@
       <div class="login-contain">
         <p class="paragraph-2">Pour afficher les tarifs, ajouter des produits à votre sélection, et nous envoyer une demande de devis, veuillez vous identifier :</p>
         <div class="form-block w-form">
-          <form id="wf-form-login" name="wf-form-Mot-de-passe" data-name="Mot de passe" redirect="/" data-redirect="/" action="/landing/login" method="post" class="form" data-wf-page-id="661004d856d8b276759afc4f" data-wf-element-id="99ae6f83-e84a-81db-916c-513b0ba9ed1a"><label for="name" class="field-label">Adresse Email</label><input class="text-field w-input" autofocus="true" maxlength="256" name="name" data-name="Name" placeholder="" type="email" id="name" required=""><label for="Mot-de-passe" class="field-label">Mot de passe</label><input class="text-field w-input" maxlength="256" name="Mot-de-passe" data-name="Mot de passe" placeholder="" type="password" id="Mot-de-passe" required=""><input type="submit" data-wait="Please wait..." class="submit-button w-button" value="S&#x27;IDENTIFIER"></form>
+          <form id="wf-form-login" name="wf-form-Mot-de-passe" data-name="Mot de passe" redirect="/" data-redirect="/" action="/landing/login" method="post" class="form" data-wf-page-id="661004d856d8b276759afc4f" data-wf-element-id="99ae6f83-e84a-81db-916c-513b0ba9ed1a"><label for="email" class="field-label">Adresse Email</label><input class="text-field w-input" autofocus="true" maxlength="256" name="email" data-name="email" placeholder="" type="email" id="email" required=""><label for="password" class="field-label">Mot de passe</label><input class="text-field w-input" maxlength="256" name="password" data-name="password" placeholder="" type="password" id="password" required=""><input type="submit" data-wait="Please wait..." class="submit-button w-button" value="S&#x27;IDENTIFIER"></form>
           <div class="w-form-done">
             <div>Thank you! Your submission has been received!</div>
           </div>
index 6b762bd7b5c61a7dfb85b9c56f85f34703024de8..3bee40edd04af3089bf6a9befc2447cd653b9705 100644 (file)
@@ -1,6 +1,15 @@
 $(function () {
     $('#wf-form-login').on('submit', function (e) {
-        alert('non !! va pas sur ' + $(this).attr('action'));
+        $.ajax(
+            {
+                url: $(this).attr('action'),
+                method: "POST",
+                data: $(this).serialize(),
+                dataType: 'json',
+                success: function (data) {
+
+                }
+            });
         return false;
     });
 });
index ba8d60f7cd7355a39f771f00a32fd99deaec3e2d..a1b6d362bc77b05def964539477c6877e511a25c 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html><!--  This site was created in Webflow. https://www.webflow.com  -->
-<!--  Last Published: Thu Apr 18 2024 18:05:34 GMT+0000 (Coordinated Universal Time)  -->
+<!--  Last Published: Fri Apr 19 2024 08:21:02 GMT+0000 (Coordinated Universal Time)  -->
 <html data-wf-page="6620d6998fd60c549bb8274d" data-wf-site="661004d856d8b276759afc40">
 <head>
   <meta charset="utf-8">
index ea13b82775fa829eb7ee9aa9240bcc8c9196ee56..dcd368e25033b54a778f8c1181e29784fd3f8dd8 100644 (file)
@@ -1,8 +1,17 @@
 <?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\WebflowController::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(['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]);