/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::customer()->check()) {
         return redirect()->intended('customer/dashboard');
     }
     return $next($request);
 }
Exemplo n.º 2
0
 public function forgot_password(Form $form)
 {
     $request = $form->request->all();
     if (!Auth::customer()->forgotPassword($request['email'])) {
         $error = trans('account.alerts.wrong_password_forgot');
         Message::addError($error);
         throw new \Exception($error);
     }
     Message::addSuccess(trans('account.alerts.password_forgot'));
 }
Exemplo n.º 3
0
 public function forgot_password(Form $form)
 {
     $auth = Auth::customer();
     $request = $form->request->all();
     if ($auth->forgotPassword($request['email'])) {
         Message::addSuccess(trans('account.alerts.password_forgot'));
     } else {
         Message::addError(trans('account.alerts.wrong_password_forgot'));
     }
 }
Exemplo n.º 4
0
 protected function header()
 {
     $top_links = menu('header.links');
     $top_links->add('cart', ['href' => url('cart'), 'text' => 'Cart #' . $this->cart->id . ' - ' . $this->cart->getSummary() . ' item(s)']);
     if (Auth::customer()->check()) {
         $top_links->add('account', ['href' => url('customer/dashboard'), 'text' => 'My Account']);
         $top_links->add('logout', ['href' => url('customer/logout'), 'text' => 'Logout']);
     } else {
         $top_links->add('login', ['href' => url('customer/login'), 'text' => 'Login/Register']);
     }
 }
Exemplo n.º 5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::customer()->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('customer/login');
         }
     }
     return $next($request);
 }
Exemplo n.º 6
0
 /**
  * Create a new authentication controller instance.
  */
 public function __construct()
 {
     $this->auth = Auth::customer();
     $this->middleware('guest', ['except' => 'getLogout']);
     $this->loadLayout();
 }
Exemplo n.º 7
0
 /**
  * Create a new authentication controller instance.
  */
 public function __construct()
 {
     $this->auth = Auth::customer();
     $this->middleware('auth');
     $this->loadLayout();
 }