Пример #1
1
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CookieJar $cookieJar, Request $request)
 {
     if ($request->isMethod('post')) {
         $supplier_email = $request->get('supplier_email');
         $supplier_password = $request->get('supplier_password');
         $checkAgentExists = Supplier::where("email", "=", $supplier_email);
         $checkAgentExists = $checkAgentExists->where("password", "=", md5($supplier_password . Config::get('constants.SITENAME')));
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('supplier_email', $supplier_email, 60));
             $cookieJar->queue(Cookie::make('supplier_password', $supplier_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('supplier_email'));
             $cookieJar->queue(Cookie::forget('supplier_password'));
         }
         if (count($checkAgentExists) > 0) {
             Session::put('SUPPLIER_ACCESS_ID', $checkAgentExists[0]->id);
             Session::put('SUPPLIER_ACCESS_FNAME', $checkAgentExists[0]->first_name);
             Session::put('SUPPLIER_ACCESS_LNAME', $checkAgentExists[0]->last_name);
             return redirect('supplier/dashboard');
         } else {
             return Redirect::route('supplier_land')->with('message', ['Invalid email address or/and password.']);
         }
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (php_sapi_name() == 'cli' || !INSTALLED) {
         return $next($request);
     }
     $lastUpdate = $request->cookie('last_visit');
     if (!$lastUpdate || $lastUpdate->day != Carbon::now()->day) {
         $this->stat->increment('visits');
         $cookie = $this->cookieJar->forever('last_visit', Carbon::now());
         $this->cookieJar->queue($cookie);
     }
     return $next($request);
 }
Пример #3
0
 /**
  * @param Request $request
  * @param CookieJar $cookie
  * @return \Illuminate\Http\RedirectResponse
  */
 public function skip(Request $request, CookieJar $cookie)
 {
     if ($request->get('skip', false)) {
         $cookie->queue(cookie('intro', 'skipped'));
     }
     return redirect()->route('home');
 }
Пример #4
0
 public function tambahpoll(CookieJar $cookieJar, Request $request)
 {
     $input = $request->except('_token');
     $update = Models\Jawaban::where('id_soal_poll', $input['id_soal_poll'])->where('jawaban', $input['jawaban'])->first();
     $update->counter = $update->counter + 1;
     $update->update();
     $cookieJar->queue(cookie('polling', 'sudah', 45000));
     return redirect()->to('lihatpoll');
 }
Пример #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(CookieJar $cookieJar, Request $request)
 {
     if (Session::has('ADMIN_ACCESS_ID')) {
         return redirect('admin/dashboard');
     }
     if ($request->isMethod('post')) {
         $admin_email = $request->get('admin_email');
         $admin_password = $request->get('admin_password');
         $checkAgentExists = Admin::where("email", "=", $admin_email);
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('admin_email', $admin_email, 60));
             $cookieJar->queue(Cookie::make('admin_password', $admin_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('admin_email'));
             $cookieJar->queue(Cookie::forget('admin_password'));
         }
         if (count($checkAgentExists) > 0) {
             if (Hash::check($admin_password, $checkAgentExists[0]->password)) {
                 Session::put('ADMIN_ACCESS_ID', $checkAgentExists[0]->id);
                 Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
                 Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
                 return redirect::route('dashboard');
             } else {
                 return redirect::route('admin')->with('errorMessage', 'Invalid password provided.');
             }
         } else {
             return redirect::route('admin')->with('errorMessage', 'Invalid email address or/and password provided.');
         }
     }
     $data = array();
     $data['admin_email'] = '';
     $data['admin_password'] = '';
     $admin_email = Cookie::get('admin_email');
     $admin_password = Cookie::get('admin_password');
     if ($admin_email && $admin_password) {
         $data['admin_email'] = $admin_email;
         $data['admin_password'] = $admin_password;
     }
     return view('admin/login', $data);
 }
 public function login(\Illuminate\Cookie\CookieJar $cookieJar, \Request $request)
 {
     // Replace 1234 with your APP_ID
     // Replace 123456789 with your APP_SECRET
     FacebookSession::setDefaultApplication('1234', '123456789');
     $helper = new FacebookRedirectLoginHelper(\Request::url());
     if ($session = $helper->getSessionFromRedirect()) {
         $request = new FacebookRequest($session, 'GET', '/me');
         $userData = $request->execute()->getGraphObject(GraphUser::className());
         $cookieJar->queue(cookie('access_token', $session->getAccessToken(), 45000));
     }
     return redirect($helper->getLoginUrl());
 }
Пример #7
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CookieJar $cookieJar, Request $request)
 {
     if ($request->isMethod('post')) {
         $agent_email = $request->get('agent_email');
         $agent_password = $request->get('agent_password');
         $checkAgentExists = Agent::where("email", "=", $agent_email);
         //$checkAgentExists	= $checkAgentExists->where("password", "=", md5($agent_password.\Config::get('constants.SITENAME')));
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('agent_email', $admin_email, 60));
             $cookieJar->queue(Cookie::make('agent_password', $admin_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('agent_email'));
             $cookieJar->queue(Cookie::forget('agent_password'));
         }
         if (count($checkAgentExists) > 0) {
             if (Hash::check($agent_password, $checkAgentExists[0]->password)) {
                 Session::put('AGENT_ACCESS_ID', $checkAgentExists[0]->id);
                 Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
                 Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
                 return redirect::to('agent/dashboard');
             } else {
                 return redirect::route('agent')->with('errorMessage', 'Invalid password provided.');
             }
         } else {
             return redirect::route('agent')->with('errorMessage', 'Invalid email address or/and password provided.');
         }
         //if(count($checkAgentExists) > 0){
         //	Session::put('AGENT_ACCESS_ID', $checkAgentExists[0]->id);
         //	Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
         //	Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
         //	return redirect('agent/dashboard');
         //}else{
         //	return redirect('agent')->with('message', 'Invalid email address or/and password.');
         //}
     }
 }
Пример #8
0
 /**
  * Queue a cookie to send with the next response.
  *
  * @param mixed
  * @return void 
  * @static 
  */
 public static function queue()
 {
     \Illuminate\Cookie\CookieJar::queue();
 }
Пример #9
0
 /**
  * {@inheritDoc}
  */
 public function forget()
 {
     $cookie = $this->jar->forget($this->key);
     $this->jar->queue($cookie);
 }
Пример #10
0
 /**
  * {@inheritDoc}
  */
 public function destroy($sessionId)
 {
     $this->cookie->queue($this->cookie->forget($sessionId));
 }
Пример #11
0
 /**
  * Delete a cookie
  *
  * @param string $cookieName
  *
  * @return bool
  */
 public function delete($cookieName)
 {
     $cookie = $this->cookie->forget($cookieName);
     $this->cookie->queue($cookie);
     return true;
 }
Пример #12
0
 public function __construct(CookieJar $cookieJar, Request $request)
 {
     $cookieJar->queue(cookie('hasSeenCookieNotice', 157680000));
     parent::__construct();
 }