]> _ Git - pmi.git/commitdiff
wip #5789 @7:00
authorsoufiane <soufiane@cubedesigners.com>
Fri, 17 Mar 2023 17:41:20 +0000 (18:41 +0100)
committersoufiane <soufiane@cubedesigners.com>
Fri, 17 Mar 2023 17:41:20 +0000 (18:41 +0100)
26 files changed:
app/Http/Controllers/AjaxController.php
app/Http/Controllers/ClientController.php
app/Http/Controllers/SignInController.php
app/Http/Kernel.php
app/Http/Middleware/RedirectClientIfAuthenticated.php [new file with mode: 0644]
app/Http/Middleware/RedirectIfAuthenticated.php
app/Models/AuthClient.php [new file with mode: 0644]
app/Models/BackpackClient.php [deleted file]
app/Models/Client.php [new file with mode: 0644]
app/Models/Clients.php [deleted file]
app/Templates/Base.php
app/Templates/Home.php
app/Templates/MyAccount.php [new file with mode: 0644]
app/Templates/SignIn.php
config/auth.php
config/debugbar.php [new file with mode: 0644]
resources/js/app.js
resources/styles/common/setup.styl
resources/styles/components/header.styl
resources/styles/components/navigation.styl
resources/views/pages/home.blade.php
resources/views/pages/sign_in.blade.php
resources/views/partials/account.blade.php
resources/views/partials/header.blade.php
resources/views/partials/nav-account.blade.php [new file with mode: 0644]
routes/web.php

index 6372628e12f90242737cf6c4a6b6bd7e734dc61c..427f6e3e70d28e173c906ce35e3dfe8bcefc6e88 100644 (file)
@@ -8,7 +8,7 @@ use App\Models\Product;
 use App\Models\QuoteRequest;
 use App\Models\Settings;
 use App\Models\News;
-use App\Models\Clients;
+use App\Models\Client;
 use Carbon\Carbon;
 use Cubist\Backpack\app\Http\Controllers\CubistFrontController;
 use Cubist\Backpack\app\Magic\PageData;
@@ -18,7 +18,6 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Mail;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Hash;
-use Illuminate\Http\RedirectResponse;
 use Illuminate\Support\Facades\Auth;
 
 class AjaxController extends CubistFrontController
@@ -288,15 +287,14 @@ class AjaxController extends CubistFrontController
             throw new ValidationException($validator);
         }
 
-        $email = Clients::where('email', $request->email)->get();
+        $email = Client::where('email', $request->email)->get();
         return $email;
     }
 
-    public function signin(Request $request)
-    {
+    public function signin(Request $request) {
         $validation = [
             'email' => 'required|email',
-            'password' => 'required',
+            'password' => 'required'
         ];
 
         $validator = Validator::make($request->all(), $validation);
@@ -305,15 +303,21 @@ class AjaxController extends CubistFrontController
             throw new ValidationException($validator);
         }
 
+        $status = Client::where('email', $request->email)->get('status');
+        if (!$status) {
+            throw ValidationException::withMessages(['email' => __('Le compte lié à cette adresse est en cours de validation')]);
+        }
+
         $validator->validate();
         $data = $validator->validated();
 
-        if (Auth::guard('web-clients')->attempt($data)) {
-            $request->session()->regenerate();
+        $remember = $request->stay_log ? true : false;
 
-            var_dump(Auth::user());
+        if (Auth::guard('web-clients')->attempt($data, $remember)) {
+            $request->session()->regenerate();
+            return Auth::guard('web-clients')->user();
         }else{
-            return 'pas ok';
+            return false;
         }
     }
 
@@ -346,7 +350,7 @@ class AjaxController extends CubistFrontController
         $data['status'] = 0;
         $data['password'] = Hash::make($data['password']);
 
-        $client = new Clients($data);
+        $client = new Client($data);
         $client->save();
 
         return $data;
index 3678462d2f134e093af55f5de69abe5dcbd883fb..600afc1e4dfaaf4472c457badc88a04ea580b993 100644 (file)
@@ -1,14 +1,28 @@
 <?php
 namespace App\Http\Controllers;
 
+use Cubist\Backpack\app\Magic\Menu\Menu;
+use Cubist\Backpack\app\Magic\Models\CMSPage;
+use Cubist\Backpack\app\Magic\Models\Locale;
+use Cubist\Backpack\app\Magic\Models\Settings;
+use Cubist\Backpack\Facades\App;
+use Illuminate\Foundation\Auth\User as Authenticatable;
 use Illuminate\Http\Request;
-use App\Models\BackpackClient;
+use Illuminate\Http\RedirectResponse;
 use Illuminate\Support\Facades\Auth;
-use Cubist\Backpack\app\Http\Controllers\CubistFrontController;
+use Cubist\Backpack\app\Http\Controllers\CubistPageController;
+use Illuminate\Support\Str;
 
-class ClientController extends CubistFrontController
+class ClientController extends CubistPageController
 {
-    public function view(Request $request) {
-        return $request->user();
+    public function logout(Request $request): RedirectResponse
+    {
+        //Auth::guard('web-clients')->logout();
+
+        $request->session()->invalidate();
+
+        $request->session()->regenerateToken();
+
+        return redirect('/se-connecter');
     }
 }
index 627c536f8acfc5a13d18c9d2b6fce797bf73877f..b4bcd69e84661de38418683fff6b0b31178ed1a3 100644 (file)
@@ -10,7 +10,7 @@ use Illuminate\Http\Request;
 
 class SignInController extends CubistFrontController
 {
-    public function view(Request $request, $id)
+    public function view(Request $request)
     {
         return view('pages.signin');
     }
index 55cc452f3ae553b6046d512bccf0399ec4c414a5..c08ad9d9326c14129e87f1e72d82c3badcf64183 100644 (file)
@@ -64,6 +64,7 @@ class Kernel extends HttpKernel
         'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
         'can' => \Illuminate\Auth\Middleware\Authorize::class,
         'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
+        'client' => \App\Http\Middleware\RedirectClientIfAuthenticated::class,
         'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
         'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
         'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
diff --git a/app/Http/Middleware/RedirectClientIfAuthenticated.php b/app/Http/Middleware/RedirectClientIfAuthenticated.php
new file mode 100644 (file)
index 0000000..3e11903
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+use Illuminate\Support\Facades\Auth;
+
+class RedirectClientIfAuthenticated
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if ($request->is('se-connecter') && Auth::guard('web-clients')->check()) {
+            return redirect('/');
+        }
+
+        return $next($request);
+    }
+}
index e4cec9c8b11b242137e1a4ed5ddc8bfb35d898c4..e27860e24ed265719a02f5e2d06d856f6fd3fc46 100644 (file)
@@ -18,7 +18,7 @@ class RedirectIfAuthenticated
     public function handle($request, Closure $next, $guard = null)
     {
         if (Auth::guard($guard)->check()) {
-            return redirect('/home');
+            return redirect('/');
         }
 
         return $next($request);
diff --git a/app/Models/AuthClient.php b/app/Models/AuthClient.php
new file mode 100644 (file)
index 0000000..ada747e
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+namespace App\Models;
+
+use Illuminate\Foundation\Auth\User as Authenticatable;
+
+class AuthClient extends Authenticatable
+{
+
+    protected $table = 'clients';
+
+    /**
+     * The attributes that are mass assignable.
+     *
+     * @var array
+     */
+    protected $fillable = [
+        'email', 'password',
+    ];
+
+    /**
+     * The attributes that should be hidden for arrays.
+     *
+     * @var array
+     */
+    protected $hidden = [
+        'remember_token',
+    ];
+}
diff --git a/app/Models/BackpackClient.php b/app/Models/BackpackClient.php
deleted file mode 100644 (file)
index 1d29377..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-namespace App\Models;
-
-use App\User;
-use Backpack\Base\app\Models\Traits\InheritsRelationsFromParentModel;
-use Backpack\Base\app\Notifications\ResetPasswordNotification as ResetPasswordNotification;
-
-class BackpackClient extends User
-{
-    use InheritsRelationsFromParentModel;
-
-    protected $table = 'clients';
-}
diff --git a/app/Models/Client.php b/app/Models/Client.php
new file mode 100644 (file)
index 0000000..f485d41
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
+
+class Client extends CubistMagicAbstractModel
+{
+
+    protected $table = 'clients';
+
+    protected $_options = ['name' => 'clients',
+        'singular' => 'Client',
+        'plural' => 'Client'];
+
+    public function setFields()
+    {
+        parent::setFields();
+
+        $this->addField(['name' => 'email',
+            'label' => 'Email',
+            'type' => 'Email',
+            'column' => true,
+            'tab' => 'Informations client']);
+
+        $this->addField(['name' => 'password',
+            'label' => 'Password',
+            'type' => 'Text']);
+
+        $this->addField(['name' => 'name',
+            'label' => 'Nom',
+            'type' => 'Text',
+            'column' => true,
+            'tab' => 'Informations client']);
+
+        $this->addField(['name' => 'firstname',
+            'label' => 'Prénom',
+            'type' => 'Text',
+            'column' => true,
+            'tab' => 'Informations client']);
+
+        $this->addField(['name' => 'company',
+            'label' => 'Société',
+            'type' => 'Text',
+            'column' => true,
+            'tab' => 'Informations client']);
+
+        $this->addField(['name' => 'vat',
+            'label' => 'TVA',
+            'type' => 'Text',
+            'column' => true,
+            'tab' => 'Informations client']);
+
+        $this->addField(['name' => 'siren',
+            'label' => 'Siren',
+            'type' => 'Number',
+            'column' => true,
+            'tab' => 'Informations client'
+            ]);
+
+        $this->addField([
+            'name' => 'address',
+            'label' => 'Adresse',
+            'type' => 'BunchOfFieldsMultiple',
+            'bunch' => 'App\SubForms\Address',
+            'column' => true,
+            'tab' => 'Informations client'
+        ]);
+
+        $this->addField(['name' => 'status',
+            'label' => 'Utilisateur approuvé',
+            'type' => 'Checkbox',
+            'column' => true,
+            'tab' => 'Informations client'
+            ]);
+
+        $this->addField([
+           'name' => 'remember_token',
+            'label' => 'remember_token',
+           'type' => 'Text',
+           'column' => true
+        ]);
+    }
+}
diff --git a/app/Models/Clients.php b/app/Models/Clients.php
deleted file mode 100644 (file)
index e8c7424..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-namespace App\Models;
-
-use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
-
-class Clients extends CubistMagicAbstractModel
-{
-    protected $table = 'clients';
-
-    protected $_options = ['name' => 'clients',
-        'singular' => 'Client',
-        'plural' => 'Clients'];
-
-    public function setFields()
-    {
-        parent::setFields();
-
-        $this->addField(['name' => 'email',
-            'label' => 'Email',
-            'type' => 'Email',
-            'column' => true,
-            'tab' => 'Informations client']);
-
-        $this->addField(['name' => 'password',
-            'label' => 'Password',
-            'type' => 'Text']);
-
-        $this->addField(['name' => 'name',
-            'label' => 'Nom',
-            'type' => 'Text',
-            'column' => true,
-            'tab' => 'Informations client']);
-
-        $this->addField(['name' => 'firstname',
-            'label' => 'Prénom',
-            'type' => 'Text',
-            'column' => true,
-            'tab' => 'Informations client']);
-
-        $this->addField(['name' => 'company',
-            'label' => 'Société',
-            'type' => 'Text',
-            'column' => true,
-            'tab' => 'Informations client']);
-
-        $this->addField(['name' => 'vat',
-            'label' => 'TVA',
-            'type' => 'Text',
-            'column' => true,
-            'tab' => 'Informations client']);
-
-        $this->addField(['name' => 'siren',
-            'label' => 'Siren',
-            'type' => 'Number',
-            'column' => true,
-            'tab' => 'Informations client'
-            ]);
-
-        $this->addField([
-            'name' => 'address',
-            'label' => 'Adresse',
-            'type' => 'BunchOfFieldsMultiple',
-            'bunch' => 'App\SubForms\Address',
-            'column' => true,
-            'tab' => 'Informations client'
-        ]);
-
-        $this->addField(['name' => 'status',
-            'label' => 'Utilisateur approuvé',
-            'type' => 'Checkbox',
-            'column' => true,
-            'tab' => 'Informations client'
-            ]);
-    }
-}
index 694bb749a58db2aed0f47b45de90aae8b37d7f42..7ba53a96930d935249c2080a01134715fe831122 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\Templates;
 
 use Cubist\Backpack\app\Template\TemplatePage;
+use http\Env\Request;
 
 class Base extends TemplatePage
 {
index fb2ae07ca6e514538a884cdcf3e28f9173267769..b6aff91d5f871fca4e325f6de934cd90a0c50944 100644 (file)
@@ -78,7 +78,7 @@ class Home extends Base
             'type' => 'BunchOfFieldsMultiple',
             'bunch' => 'App\SubForms\Logo',
             'label' => 'Logos',
-            'tab' => 'Clients']);
+            'tab' => 'Client']);
     }
 
     // Set extra data for Home blade view
diff --git a/app/Templates/MyAccount.php b/app/Templates/MyAccount.php
new file mode 100644 (file)
index 0000000..b04fb45
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+
+namespace App\Templates;
+
+
+class MyAccount extends Base
+{
+    public function getName()
+    {
+        return 'Mon compte';
+    }
+
+    public function init()
+    {
+        parent::init();
+    }
+}
index 79fe734b01332358a64f5ee09f0514b9eb8b87dd..6d151789988ce9fbe9555fbf3ae89ab51c554187 100644 (file)
@@ -14,27 +14,5 @@ class SignIn extends Base
     public function init()
     {
         parent::init();
-
-        $form_login = "Formulaire de connexion";
-        $form_register = "Formulaire d'inscription";
-
-        $this->removeField('intro');
-
-        $this->addField(['name'  => 'page_heading',
-            'type'  => 'Text',
-            'label' => 'Titre de la page',
-            'tab'   => 'Contenus'
-        ]);
-
-        $this->addField([
-           'name' => 'email',
-           'type' => 'Email',
-           'label' => 'Email',
-            'tab' => $form_login
-        ]);
-
-
-        // Enable form
-        $this->addForm();
     }
 }
index 86aae4279021d19258b09f5c8c3ac2eb8d55a1c0..b76695215d79e9c97f1fd2f4a3cea607b85ba3c2 100644 (file)
@@ -77,7 +77,7 @@ return [
 
         'clients' => [
             'driver' => 'eloquent',
-            'model' => App\Models\BackpackClient::class,
+            'model' => App\Models\AuthClient::class,
         ]
 
         // 'users' => [
diff --git a/config/debugbar.php b/config/debugbar.php
new file mode 100644 (file)
index 0000000..6aed981
--- /dev/null
@@ -0,0 +1,215 @@
+<?php
+
+return [
+
+    /*
+     |--------------------------------------------------------------------------
+     | Debugbar Settings
+     |--------------------------------------------------------------------------
+     |
+     | Debugbar is enabled by default, when debug is set to true in app.php.
+     | You can override the value by setting enable to true or false instead of null.
+     |
+     | You can provide an array of URI's that must be ignored (eg. 'api/*')
+     |
+     */
+
+    'enabled' => env('DEBUGBAR_ENABLED', null),
+    'except' => [
+        'telescope*',
+        'horizon*'
+    ],
+
+    /*
+     |--------------------------------------------------------------------------
+     | Storage settings
+     |--------------------------------------------------------------------------
+     |
+     | DebugBar stores data for session/ajax requests.
+     | You can disable this, so the debugbar stores data in headers/session,
+     | but this can cause problems with large data collectors.
+     | By default, file storage (in the storage folder) is used. Redis and PDO
+     | can also be used. For PDO, run the package migrations first.
+     |
+     */
+    'storage' => [
+        'enabled'    => true,
+        'driver'     => 'file', // redis, file, pdo, custom
+        'path'       => storage_path('debugbar'), // For file driver
+        'connection' => null,   // Leave null for default connection (Redis/PDO)
+        'provider'   => '' // Instance of StorageInterface for custom driver
+    ],
+
+    /*
+     |--------------------------------------------------------------------------
+     | Vendors
+     |--------------------------------------------------------------------------
+     |
+     | Vendor files are included by default, but can be set to false.
+     | This can also be set to 'js' or 'css', to only include javascript or css vendor files.
+     | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
+     | and for js: jquery and and highlight.js
+     | So if you want syntax highlighting, set it to true.
+     | jQuery is set to not conflict with existing jQuery scripts.
+     |
+     */
+
+    'include_vendors' => true,
+
+    /*
+     |--------------------------------------------------------------------------
+     | Capture Ajax Requests
+     |--------------------------------------------------------------------------
+     |
+     | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
+     | you can use this option to disable sending the data through the headers.
+     |
+     | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
+     */
+
+    'capture_ajax' => true,
+    'add_ajax_timing' => false,
+
+    /*
+     |--------------------------------------------------------------------------
+     | Custom Error Handler for Deprecated warnings
+     |--------------------------------------------------------------------------
+     |
+     | When enabled, the Debugbar shows deprecated warnings for Symfony components
+     | in the Messages tab.
+     |
+     */
+    'error_handler' => false,
+
+    /*
+     |--------------------------------------------------------------------------
+     | Clockwork integration
+     |--------------------------------------------------------------------------
+     |
+     | The Debugbar can emulate the Clockwork headers, so you can use the Chrome
+     | Extension, without the server-side code. It uses Debugbar collectors instead.
+     |
+     */
+    'clockwork' => false,
+
+    /*
+     |--------------------------------------------------------------------------
+     | DataCollectors
+     |--------------------------------------------------------------------------
+     |
+     | Enable/disable DataCollectors
+     |
+     */
+
+    'collectors' => [
+        'phpinfo'         => true,  // Php version
+        'messages'        => true,  // Messages
+        'time'            => true,  // Time Datalogger
+        'memory'          => true,  // Memory usage
+        'exceptions'      => true,  // Exception displayer
+        'log'             => true,  // Logs from Monolog (merged in messages if enabled)
+        'db'              => true,  // Show database (PDO) queries and bindings
+        'views'           => true,  // Views with their data
+        'route'           => true,  // Current route information
+        'auth'            => true, // Display Laravel authentication status
+        'gate'            => true,  // Display Laravel Gate checks
+        'session'         => true,  // Display session data
+        'symfony_request' => true,  // Only one can be enabled..
+        'mail'            => true,  // Catch mail messages
+        'laravel'         => false, // Laravel version and environment
+        'events'          => false, // All events fired
+        'default_request' => false, // Regular or special Symfony request logger
+        'logs'            => false, // Add the latest log messages
+        'files'           => false, // Show the included files
+        'config'          => false, // Display config settings
+        'cache'           => false, // Display cache events
+        'models'          => true,  // Display models
+        'livewire'        => true,  // Display Livewire (when available)
+    ],
+
+    /*
+     |--------------------------------------------------------------------------
+     | Extra options
+     |--------------------------------------------------------------------------
+     |
+     | Configure some DataCollectors
+     |
+     */
+
+    'options' => [
+        'auth' => [
+            'show_name' => true,   // Also show the users name/email in the debugbar
+        ],
+        'db' => [
+            'with_params'       => true,   // Render SQL with the parameters substituted
+            'backtrace'         => true,   // Use a backtrace to find the origin of the query in your files.
+            'backtrace_exclude_paths' => [],   // Paths to exclude from backtrace. (in addition to defaults)
+            'timeline'          => false,  // Add the queries to the timeline
+            'explain' => [                 // Show EXPLAIN output on queries
+                'enabled' => false,
+                'types' => ['SELECT'],     // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
+            ],
+            'hints'             => false,    // Show hints for common mistakes
+        ],
+        'mail' => [
+            'full_log' => false
+        ],
+        'views' => [
+            'data' => false,    //Note: Can slow down the application, because the data can be quite large..
+        ],
+        'route' => [
+            'label' => true  // show complete route on bar
+        ],
+        'logs' => [
+            'file' => null
+        ],
+        'cache' => [
+            'values' => true // collect cache values
+        ],
+    ],
+
+    /*
+     |--------------------------------------------------------------------------
+     | Inject Debugbar in Response
+     |--------------------------------------------------------------------------
+     |
+     | Usually, the debugbar is added just before </body>, by listening to the
+     | Response after the App is done. If you disable this, you have to add them
+     | in your template yourself. See http://phpdebugbar.com/docs/rendering.html
+     |
+     */
+
+    'inject' => true,
+
+    /*
+     |--------------------------------------------------------------------------
+     | DebugBar route prefix
+     |--------------------------------------------------------------------------
+     |
+     | Sometimes you want to set route prefix to be used by DebugBar to load
+     | its resources from. Usually the need comes from misconfigured web server or
+     | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
+     |
+     */
+    'route_prefix' => '_debugbar',
+
+    /*
+     |--------------------------------------------------------------------------
+     | DebugBar route domain
+     |--------------------------------------------------------------------------
+     |
+     | By default DebugBar route served from the same domain that request served.
+     | To override default domain, specify it as a non-empty value.
+     */
+    'route_domain' => null,
+
+    /*
+     |--------------------------------------------------------------------------
+     | DebugBar theme
+     |--------------------------------------------------------------------------
+     |
+     | Switches between light and dark theme. If set to auto it will respect system preferences
+     | Possible values: auto, light, dark
+     */
+    'theme' => 'auto',
+];
index d44a1b9dac1dd5778eab5bbb02862e6351f744b3..ab3961453aec8a6ba274b605638ed39afcf7d959 100644 (file)
@@ -172,17 +172,16 @@ const app = new Vue({
                 form = document.getElementById('signin-form'),
                 data = new FormData(form)
 
-            console.log(form)
-
             axios.post('/ajax/signin', data)
                 .then(function (response) {
                     //
-                    let lastVisitedUrl = document.referrer;
+
+                    let lastVisitedUrl = document.querySelector('[name="previous-url"]').getAttribute('content');
                     let homeUrl = window.location.origin;
 
                     if(lastVisitedUrl){
                         if(lastVisitedUrl.includes('pm-instrumentation')){
-                            history.back()
+                            window.location.replace(lastVisitedUrl)
                         }else{
                             window.location.replace(homeUrl)
                         }
index f5d7b98b7ec58c4b948b46036dfc9a50d2f21b85..a5e9be00e17ad04f213e69b993aa23ba98d56db5 100644 (file)
@@ -8,7 +8,7 @@ $base-width        = 1920px // Basis for vw unit calculations on large screens
 $content-max-width = $base-width * 0.9 // Allows 5% either side
 
 $header-height = 134px
-$header-height-minimized = 60px
+$header-height-minimized = 75px
 $transition-duration = 500ms
 
 // Gutters (assumed to always be a vw, vh or % unit)
index 849863a6ccd9a8d70f4669682212b28ee0b3659d..e799d6284e9eff5a06105b050c7a0eb642dbb804 100644 (file)
@@ -26,7 +26,6 @@
     width: 34px
     height: 36px
 
-
 .site-header
 
   @apply bg-navy text-white text-lg font-display font-medium antialiased fixed top-0
index 74b44f150077d01789b9110d97735c27259bf2d1..6c0ba8b63345d51e53f69dabdd560e2561ae4d5c 100644 (file)
@@ -5,8 +5,8 @@
   to
     opacity: 1
 
-.nav-primary
-  @apply flex mx-auto px-8
+.nav-primary,
+.account-header
 
   // Trigger for submenus, at any depth
   li:hover > ul
@@ -95,6 +95,9 @@
       overflow: hidden
       text-overflow: ellipsis
 
+.nav-primary
+  @apply flex mx-auto px-8
+
 #mobile-nav
   +below($breakpoint-menu)
     display: block
index 20f5383527320cb7a22c5e7fe0c8d18bdf8ee172..793a12e6588e70f69f9feca4c80021e77b20f92f 100644 (file)
     @endif
 
     @if(config('features.clients'))
-        {{-- Our Clients --}}
+        {{-- Our Client --}}
         <full-width class="bg-grey-100">
             <content>
                 <text-block :title="__('Nos clients')"/>
index 8b9591b5c05ea98d8d813d63dbd39233adf7f34c..0edef208541d17ad6606f20c50ff787526050727 100644 (file)
@@ -57,7 +57,7 @@
                     </div>
                     <div class="form-group mb-5">
                         <label class="flex items-center">
-                            <input type="checkbox" name="stay-log" class="w-4 h-4" />
+                            <input type="checkbox" name="remember_me" class="w-4 h-4" />
                             <span class="ml-4">{{ __('Rester connecté') }}</span>
                         </label>
                     </div>
index 15348a1a56b464380253c0768913c304a0af3c36..54bc12b6c2fed7fac816d3d4d13400a663077c21 100644 (file)
@@ -1,4 +1,10 @@
-<span class="account-header-title">{{ __('Se connecter') }}</span>
+<span class="account-header-title">
+    @if(Auth::guard('web-clients')->check())
+        {{ Auth::guard('web-clients')->user()->firstname }}
+    @else
+        {{ __('Se connecter') }}
+    @endif
+</span>
 <span class="header-icon-wrapper account-icon-wrapper">
     @svg('icon-account', 'account-header-icon header-icon')
 </span>
index c92e6376182599e96ec68e81a43e27faff62d33c..811deae1c855d52c6c23e8170f4519abe8748b78 100644 (file)
 
         </nav>
 
-        @php
-            var_dump(Auth::user());
-        @endphp
 
-        @guest
-        <a href="{{ $nav->getHrefByName('signin') }}"
-           class="text-right flex items-center cursor-pointer text-white hover:text-primary"
-        >
-            @include('partials.account')
-        </a>
-        @endguest
+        <ul class="account-header">
+            <li>
+                <a href="{{ $nav->getHrefByName('signin') }}"
+                   class="text-right flex items-center cursor-pointer text-white hover:text-primary"
+                >
+                    @include('partials.account')
+                </a>
+                @include('partials.nav-account')
+            </li>
+        </ul>
 
         @if (config('features.quote'))
             <a href="{{ $nav->getHrefByName('cart') }}"
diff --git a/resources/views/partials/nav-account.blade.php b/resources/views/partials/nav-account.blade.php
new file mode 100644 (file)
index 0000000..7f1ba9c
--- /dev/null
@@ -0,0 +1,24 @@
+@if(Auth::guard('web-clients')->check())
+    <ul class="account-header-list">
+        <li>
+            <a href="">
+                <span>{{ __('Mon compte') }}</span>
+            </a>
+        </li>
+        <li>
+            <a href="">
+                <span>{{ __('Mes commandes') }}</span>
+            </a>
+        </li>
+        <li>
+            <a href="">
+                <span>{{ __('Panier enregistrés') }}</span>
+            </a>
+        </li>
+        <li>
+            <a href="/deconnexion">
+                <span>{{ __('Deconnexion') }}</span>
+            </a>
+        </li>
+    </ul>
+@endif
index b24ceec10bd557c1ccc7072e2a435cd78886669d..e1a381ba00d75aa863ac14269c7116c186172e62 100644 (file)
@@ -1,4 +1,7 @@
 <?php
 
+Route::get('/deconnexion', 'ClientController@logout');
+
 Route::any('{page}/{subs?}',  'PageController@catchall')
-    ->where(['page' => '^(((?=(?!admin))(?=(?!\/)).))*$', 'subs' => '.*']);
+    ->where(['page' => '^(((?=(?!admin))(?=(?!\/)).))*$', 'subs' => '.*'])
+    ->middleware('client');