Exemple #1
0
 private function autoLogin()
 {
     try {
         if (\Session::has('userID')) {
         } else {
             //try set session from cookies if no session
             if (!empty(\Cookie::get('userID'))) {
                 $field = array('field' => '_id', 'value' => (string) \Cookie::get('userID'));
                 if (Auth::isExists($field)) {
                     \Session::put('userID', \Cookie::get('userID'));
                     //
                     //return \Response::make()->withCookie(\Cookie::make('userID', \Cookie::get('userID') , self::COOKIE_EXPIRE));
                 } else {
                     throw new AuthCheckException('username', 'auth.username.doesnt.exist');
                 }
             } else {
                 //\Session::forget('userID')->withCookie(\Cookie::forget('userID'))->withCookie(\Cookie::forget('userID'));
                 throw new AuthCheckException('userid', 'auth.userid.doesnt.exist');
             }
         }
     } catch (Exception $e) {
         $return = \Response::json(["message" => "Session logout!"], 400);
         \Session::forget('userID');
         return $return->withCookie(Cookie::forget('userID'))->withCookie(Cookie::forget('userID'));
     }
 }
Exemple #2
0
 public static function logout()
 {
     Session::forget("auths");
     Cookie::forget(Config::get('auth.rememeber_cookie'));
     //
     //Url::redirect("@".Config::get('auth.login'));
 }
 /**
  * Store a newly created song in storage.
  *
  * @return Response
  */
 public function store()
 {
     // Set rules for validator
     $rules = array("artist" => "required", "title" => "required", "requester" => "required", "link" => "required|url");
     // Validate input
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         // TODO: Remember form input...
         return Redirect::to('song/create')->withErrors($validator, "song");
     }
     // Create new song
     $song = Input::all();
     // Set or unset remember cookie
     if (isset($song['remember-requester'])) {
         $cookie = Cookie::make("requester", $song['requester']);
     } else {
         $cookie = Cookie::forget("requester");
     }
     $artist = DB::getPdo()->quote($song['artist']);
     $title = DB::getPdo()->quote($song['title']);
     if (Song::whereRaw("LOWER(artist) = LOWER({$artist}) AND LOWER(title) = LOWER({$title})")->count() > 0) {
         return Redirect::to('song/create')->with('error', "HEBBEN WE AL!!!")->withCookie($cookie);
     }
     Song::create($song);
     // Set success message
     $msg = "Gefeliciteerd! Je nummer is aangevraagd :D";
     // Redirect to song index page with message and cookie
     return Redirect::to("/")->with("success", $msg)->withCookie($cookie);
 }
 public function callback()
 {
     // Create an consumer from the config
     $this->consumer = Consumer::make($this->config);
     // Load the provider
     $this->provider = Provider::make($this->provider);
     if ($token = \Cookie::get('oauth_token')) {
         // Get the token from storage
         $this->token = unserialize(base64_decode($token));
     }
     if (!property_exists($this, 'token')) {
         throw new Exception('Invalid token');
     }
     if ($this->token and $this->token->access_token !== \Input::get('oauth_token')) {
         // Delete the token, it is not valid
         \Cookie::forget('oauth_token');
         // Send the user back to the beginning
         throw new Exception('invalid token after coming back to site');
     }
     // Get the verifier
     $verifier = \Input::get('oauth_verifier');
     // Store the verifier in the token
     $this->token->verifier($verifier);
     // Exchange the request token for an access token
     return $this->provider->access_token($this->token, $this->consumer);
 }
Exemple #5
0
 /**
  * Triggers the logout process, purges Cookies and session.
  */
 public static function logout()
 {
     Session::forget('Ravenly.user');
     Session::forget('Ravenly.crsid');
     Cookie::forget('Ravenly.UcamWebauth');
     Cookie::forget('ravenly');
 }
 public function postIndex()
 {
     $input = Input::only('first_name', 'last_name', 'email', 'username', 'password', 'domain_id');
     $domain_id = Cookie::get('domain_hash') ? Cookie::get('domain_hash') : 'NULL';
     $rules = array('first_name' => 'required|min:1', 'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'username' => 'required|min:3|must_alpha_num|unique:users,username,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'password' => 'required|min:6');
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => 'register', 'errors' => $v, 'input' => TRUE));
     }
     $profile = new Profile(array('first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'website' => ''));
     $profile->save();
     $user = new User(array('domain_id' => Cookie::get('domain_hash') ? Cookie::get('domain_hash') : NULL, 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), 'status' => Cookie::get('domain_hash') ? 4 : 3));
     $user->profile()->associate($profile);
     $user->save();
     if ($user->id) {
         if ($user->status == 4) {
             $this->add_phone_number($user->id);
         }
         $cookie = Cookie::forget('rndext');
         $confirmation = App::make('email-confirmation');
         $confirmation->send($user);
         Mail::send('emails.register', array('new_user' => $input['username']), function ($message) {
             $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'))->to(Input::get('email'))->subject(_('New user registration'));
         });
         Event::fire('logger', array(array('account_register', array('id' => $user->id, 'username' => $user->username), 2)));
         //			return Output::push(array(
         //				'path' => 'register',
         //				'messages' => array('success' => _('You have registered successfully')),
         //				));
         return Redirect::to('register')->with('success', _('You have registered successfully'))->withCookie($cookie);
     } else {
         return Output::push(array('path' => 'register', 'messages' => array('fail' => _('Fail to register')), 'input' => TRUE));
     }
 }
 public function getLogout()
 {
     Session::flush();
     Cookie::forget('laravel_session');
     Auth::logout();
     return Redirect::to('/')->with('success_messages', 'Vuelve Pronto')->with('alert-class', 'alert-success');
 }
Exemple #8
0
 public static function unsetCart()
 {
     $key = \Request::cookie('shoppingCart');
     $cart = \App\Cart::where('key', $key)->first();
     $cookie = \Cookie::forget('shoppingCart');
     $cart->delete();
     return $cookie;
 }
 public function logout()
 {
     $admin_id = Cookie::forget('admin_id');
     $admin_username = Cookie::forget('admin_username');
     $k = Cookie::forget('k');
     $login_time = Cookie::forget('login_time');
     return Redirect::route('home')->withCookie($k)->withCookie($admin_id)->withCookie($admin_username)->withCookie($login_time);
 }
 public function postDelete()
 {
     $Usuario = Usuario::find(Input::get('Usuario')['id'])->update(Input::get('Usuario'));
     Session::flush();
     Cookie::forget('laravel_session');
     Auth::logout();
     return Redirect::to('/')->with('success_messages', 'Lamentamos que te hayas ido, esperamos volverte a ver')->with('alert-class', 'alert-success');
 }
 private function _setCookie()
 {
     if (Auth::user()->status == 4) {
         $cookie = Cookie::make('domain_hash', Auth::user()->domain_id);
     } else {
         $cookie = Cookie::forget('domain_hash');
     }
     return $cookie;
 }
Exemple #12
0
 public function ChecksiteLogin()
 {
     if (Input::has('site-password')) {
         if (Input::get('site-password') == Config::get('config.site_password')) {
             $cookie = Cookie::forever('siteprotection', 'YES');
             return Redirect::back()->withCookie($cookie);
         }
     }
     Cookie::forget('siteprotection');
     return Redirect::back()->with(['errors' => 'Sorry wrong password for site.']);
 }
 /**
  * View Login page
  * @return [type] [description]
  */
 public function create()
 {
     if (Auth::check()) {
         return Redirect::intended('/');
     }
     $cookies = Cookie::get();
     foreach ($cookies as $name => $cookie) {
         Cookie::queue(Cookie::forget($name));
     }
     return View::make('login');
 }
Exemple #14
0
 public function action_auth()
 {
     $email = Input::get('email');
     $pswd = Input::get('password');
     $creds = array('username' => $email, 'password' => $pswd);
     try {
         if (Auth::attempt($creds)) {
             if ($redir = Cookie::get('rid')) {
                 Cookie::forget('rid');
                 return Redirect::to($redir)->with_input();
             }
             return View::make('sapoc.pages.index');
         } else {
             return Redirect::to('login')->with('login_errors', true);
         }
     } catch (\Exception $e) {
         // TODO: Show Error page
     }
 }
Exemple #15
0
 public function __construct()
 {
     session_start();
     FacebookSession::setDefaultApplication('355697367892039', '4e86edc58e5798b253dd55c164504512');
     $this->beforeFilter('csrf', array('on' => array('post', 'delete', 'put')));
     $fbuser = User::where('facebook_id', '=', Session::get('facebook_id'))->where('facebook_id', '<>', '')->first();
     if (isset($fbuser->id)) {
         Session::put('username', $fbuser->username);
         Session::put('user_level', $fbuser->user_level);
         Session::put('id', $fbuser->id);
     } elseif (Cookie::get('ps_login') && !Session::get('id')) {
         $user = unserialize(Cookie::get('ps_login'));
         if (isset($user->id)) {
             Session::put('username', $user['username']);
             Session::put('user_level', $user['user_level']);
             Session::put('id', $user['id']);
         } else {
             Cookie::forget('ps_login');
         }
     }
 }
 public function logout()
 {
     \Session::forget('admin');
     return redirect('/admin/login')->with('message', 'You have been successfully logged out.')->withCookie(\Cookie::forget('neyko_admin_remember_token'));
 }
 /**
  * Show a single event
  * @param  [type] $slug [description]
  * @return [type]       [description]
  */
 public function show($slug)
 {
     // Grab the requestersId
     $setFriendCookie = \Input::get('suarayrequestfrom');
     // Instantiate the APIHelper
     $api = new \App\Helpers\ApiHelper();
     $id = null;
     // Check if user is logged in
     $appendAuthUserId = \Auth::check() ? 'auth_user_id=' . \Auth::user()->id . '&' : null;
     // Is this event being accessed via a private link
     $isAccessedByPrivateLink = empty($hash) ? false : true;
     // Sets private hash if available
     // Aborts if we are public and there is no hash or its empty
     // Sets events variable once validated
     $events = $this->setEvent($isAccessedByPrivateLink, $appendAuthUserId, $slug, $api);
     $eventId = isset($events['id']) ? $events['id'] : null;
     $address = urlencode($events['address1'] . ", " . $events['city'] . ", " . $events['state']);
     // Sets attendees for idividual event with count and user information
     $attendees = $this->setAttendees($appendAuthUserId, $slug, $api);
     $attendeeInfo = $attendees['attendeeInfo'];
     $attendeeList = $attendees['attendeeList'];
     $events['ticketsInventory'] = $this->unsetDisabledTickets($events);
     // QR code hash
     $hash = '$2y$10$TfnEb9qbeS4hXu.EsE.yM.nWe6uRP3XQVPXwevQeJCaDd.Pfbgt1i';
     // Sets admin check to false
     $isAdmin = false;
     $attendingStatus = [];
     $ownedEvent = [];
     // Set variables for the different privacy levels
     $shareableLink = $events['meta']['private']['shareableLink'];
     $friendsOnly = $events['meta']['private']['friendsOnly'];
     $byInvite = $events['meta']['private']['byInvite'];
     // create a privacy array
     $private = [$shareableLink, $friendsOnly, $byInvite];
     // Check if user is signed in
     if (\Auth::check()) {
         // Find if the user is attending
         $attendingStatus = $api->show('events', urlencode($slug) . '?with[]=times&auth_user_id=' . \Auth::user()->id);
         $attendingStatus = isset($attendingStatus['data']['event']['auth']['isAttending']) ? $attendingStatus['data']['event']['auth']['isAttending'] : null;
         $isAdmin = $events['userId'] == \Auth::user()->id ? true : $isAdmin;
         $friends = $this->setFriends($api);
         $api = new \App\Helpers\ApiHelper();
         // If the users ID matches the UserId of the event
         if (\Auth::user()->id == $events['userId']) {
             // Otherwise show privacy options
         } else {
             // While the one of the 3 privacy settings are true
             while (list($key, $value) = each($events['meta']['private'])) {
                 if ($value === true) {
                     $private = true;
                     // If the privacy setting is shareableLink
                     if ($private === true && $key === 'shareableLink') {
                         // Set the privacy message
                         $privateMessage = 'This event is private and only viewed with a private link';
                         // Return view
                         return \View::make('events.private')->with('privateMessage', $privateMessage);
                         // Else if the privacy setting is friends only
                     } elseif ($private === true && $key === 'friendsOnly') {
                         $friendIds = [];
                         foreach ($friends as $key => $friendId) {
                             $friendIds[] = $friendId['pivot']['friendId'];
                         }
                         // If the creater of the event are friends with the logged in user
                         if (in_array($events['userId'], $friendIds)) {
                             // Else continue on
                         } else {
                             // Set the privacy message
                             $privateMessage = 'This event is private';
                             // Return view
                             return \View::make('events.private')->with('privateMessage', $privateMessage);
                         }
                         // If the privacy setting is by invite only
                     } elseif ($private === true && $key === 'byInvite') {
                         // Set privacy message
                         $privateMessage = 'This event is private and only viewed by an invite';
                         // Return view
                         return \View::make('events.private')->with('privateMessage', $privateMessage);
                     }
                 }
             }
         }
     } else {
         // If the user is not logged in
         if (!\Auth::check() && $private === true) {
             // Return view login with the title of the event and the slug
             return \Redirect::route('login')->with('warning_message', 'In order to view ' . $events['title'] . ' you must log in')->with('previous_page', $events['slug']);
         }
         // While the one of the 3 privacy settings are true
         while (list($key, $value) = each($events['meta']['private'])) {
             if ($value === true) {
                 $private = true;
                 // If the privacy setting is shareableLink
                 if ($private === true && $key === 'shareableLink') {
                     // Set the privacy message
                     $privateMessage = 'This event is private and only viewed with a private link';
                     // Return view
                     return \View::make('events.private')->with('privateMessage', $privateMessage);
                     // Else if the privacy setting is friends only
                 } elseif ($private === true && $key === 'friendsOnly') {
                     // Set the privacy message
                     $privateMessage = 'This event is private';
                     // Return view
                     return \View::make('events.private')->with('privateMessage', $privateMessage);
                     // If the privacy setting is by invite only
                 } elseif ($private === true && $key === 'byInvite') {
                     // Set the privacy message
                     $privateMessage = 'This event is private and only viewed by an invite';
                     // Return view
                     return \View::make('events.private')->with('privateMessage', $privateMessage);
                 }
             }
         }
     }
     if (!empty($events)) {
         // Set default photo
         $defaultPhoto = null;
         // Use featured photo if available
         if (isset($events['featuredPhoto'])) {
             $defaultPhoto = $events['featuredPhoto'];
         }
         // Use first photo if available and featured photo is not available
         if ($defaultPhoto == null && isset($events['photos'][0])) {
             $defaultPhoto = $events['photos'][0];
         }
         // Sets events meta data
         $meta = $this->setMetaData($events);
         $metaTitle = $meta['metaTitle'];
         $metaDescription = $meta['metaDescription'];
         $metaKeywords = $meta['metaKeywords'];
         // Set ticket type to ticket or reservation
         $ticketType = $this->setTicketType($events);
         $tickets = $ticketType['tickets'];
         $reservations = $ticketType['reservations'];
         // Shows related events
         $relatedEvents = $this->setRelatedEvents($events, $api);
         // Set times default
         $times = [];
         // Set times Id default
         $eventTimeIdSelected = null;
         // Set times Id default
         $timesId = [];
         // Times array build and set
         foreach ($events['times'] as $key => $value) {
             // Set key if set to null
             if ($eventTimeIdSelected === null) {
                 $eventTimeIdSelected = $value['id'];
             }
             $key = $value['id'];
             $value = date('M d @ g:ia', strtotime($value['start']));
             $times[$key] = $value;
         }
         // View data
         $data = ['address' => $address, 'attendeeInfo' => $attendeeInfo, 'attendeeList' => $attendeeList, 'eventId' => $eventId, 'events' => $events, 'times' => $times, 'tickets' => $tickets, 'reservations' => $reservations, 'eventTimeIdSelected' => $eventTimeIdSelected, 'timesId' => $timesId, 'friends' => isset($friends) ? $friends : [], 'defaultPhoto' => $defaultPhoto, 'relatedEvents' => $relatedEvents, 'hash' => $hash, 'metaKeywords' => $metaKeywords, 'attendingStatus' => $attendingStatus, 'ownedEvent' => $ownedEvent, 'metaDescription' => $metaDescription, 'metaTitle' => $metaTitle, 'isAdmin' => $isAdmin, 'id' => $id, 'slug' => $slug, 'isAccessedByPrivateLink' => $isAccessedByPrivateLink];
         // Check if user is signed in
         if (\Auth::check()) {
             $user = $api->index('users/' . \Auth::user()->id . '?with[]=ticketInventories&with[]=stripeManagedAccounts&auth_user_id=' . \Auth::user()->id);
             $user = $user['data']['user'];
         }
         // The view
         $view = \View::make('events.show', $data)->with(['data' => $data, 'user' => isset($user) ? $user : null]);
         // Instanciate response
         $response = new Response($view);
         // Return response
         return $response->withCookie(\Cookie::make('suarayrequestfrom', $setFriendCookie, 43829.1))->withCookie(\Cookie::forget('purchaseCookieData'));
     }
 }
Exemple #18
0
<?php

Route::get('/{video_id?}', ['as' => 'index', 'uses' => function ($video_id = null) {
    if (isset($video_id)) {
        $video_cookie = Cookie::get('video_id');
        if ($video_cookie == $video_id) {
            Cookie::queue(Cookie::forget('video_id'));
            return Redirect::route('index');
        }
        return view('video', ['video_id' => $video_id]);
    } else {
        if (Cookie::get('video_id')) {
            Cookie::queue(Cookie::forget('video_id'));
        }
        return view('index');
    }
}]);
<?php

Route::filter('patrickrose.sharedauth', function () {
    if (Cookie::has('patrickrosesharedhost')) {
        if (Cookie::get('patrickrosesharedhost') != Config::get('laravel-sharedhost::password')) {
            die(var_dump(Config::get('app.key')));
            Cookie::forget('patrickrosesharedhost');
            return Redirect::route('patrickrose.sharedhost.login');
        }
    } else {
        return Redirect::route('patrickrose.sharedhost.login');
    }
});
Exemple #20
0
 /**
  * Log the current user out of the application.
  *
  * The "logout" closure in the authenciation configuration file will be
  * called. All authentication cookies will be deleted and the user ID
  * will be removed from the session.
  *
  * @return void
  */
 public static function logout()
 {
     call_user_func(Config::get('auth.logout'), static::user());
     static::$user = null;
     Cookie::forget(Auth::user_key);
     Cookie::forget(Auth::remember_key);
     IoC::core('session')->forget(Auth::user_key);
 }
    $user = User::find($userid);
    if (is_null($userid) || is_null($user)) {
        return Redirect::to('/');
    } else {
        return View::make('emails.download2', array('fname' => $user->fname, 'sname' => $user->lname, 'userid' => $userid));
    }
});
Route::get('restart', function () {
    if (Cookie::has('quiz_progress')) {
        $progress_id = Cookie::get('quiz_progress');
        $progress = Progress::find($progress_id);
        if ($progress) {
            $progress->delete();
        }
    }
    $cookie = Cookie::forget('quiz_progress');
    return Redirect::to('/')->withCookie($cookie);
});
Route::get('cookies', function () {
    return View::make('legal.cookies');
});
Route::get('privacy', function () {
    return View::make('legal.privacy');
});
Route::get('continue', array('before' => 'reload', function () {
    if (!Cookie::has('quiz_progress')) {
        return Redirect::to('/');
    }
    $questions = Config::get('questions');
    $progress_id = Cookie::get('quiz_progress');
    $progress = Progress::find($progress_id);
 public function login_post()
 {
     $phone = Input::get('phone');
     $password = Input::get('password');
     try {
         Sentry::authenticate(array('phone' => $phone, 'password' => $password), false);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         return Response::json(array('error_code' => 1, 'message' => '请输入手机号码'));
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         return Response::json(array('error_code' => 2, 'message' => '请输入密码'));
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Response::json(array('error_code' => 3, 'message' => '手机号或密码错误'));
     } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
         return Response::json(array('error_code' => 4, 'message' => '手机号或密码错误'));
     } catch (Exception $e) {
         return Response::json(array('error_code' => -1, 'message' => 'Unknown Error'));
     }
     $user = Sentry::getUser();
     if ($user->role) {
         return Response::json(array('error_code' => 5, 'message' => '无效用户'));
     }
     Session::put('user.id', $user->id);
     $error_message = array('error_code' => 0, 'message' => '登陆成功');
     // 通过ajax请求,则返回之前的uri,前端进行跳转
     if (Request::ajax()) {
         $error_message['uri_before'] = Session::pull('uri.before_login');
         $response = Response::json($error_message);
         if (($remember = Input::get('remember')) == 'true') {
             $response->headers->setCookie(Cookie::make('remember', true, self::$remember_expire));
             $response->headers->setCookie(Cookie::make('phone', $phone, self::$remember_expire));
             $response->headers->setCookie(Cookie::make('password', $password, self::$remember_expire));
         } else {
             $response->headers->setCookie(Cookie::forget('remember'));
             $response->headers->setCookie(Cookie::forget('phone'));
             $response->headers->setCookie(Cookie::forget('password'));
         }
         return $response;
     } else {
         $error_message['user'] = $user;
     }
     return Response::json($error_message);
 }
 public function unsubscribe(Request $request)
 {
     $cookie_list = $request->cookie('list_joined');
     $cid = $request->cookie('list_cid');
     if ($cookie_list && $cid) {
         // now we can unsubscribe the user
         $member = ListMember::find($cid);
         $member->subscribed = 0;
         $member->save();
         $list = MailList::find($cookie_list);
         $c1 = \Cookie::forget('list_joined');
         $c2 = \Cookie::forget('list_cid');
         return \Theme::display('lists.list-remove', ['list' => $list], array($c1, $c2));
     }
     // look for get varibale
     if ($request->has('e')) {
         $member = ListMember::where('email', $request->e)->first();
         $member->subscribed = 0;
         $member->save();
         $list = MailList::find($member->list_id);
         // for good measure, unset cookie too.
         $c1 = \Cookie::forget('list_joined');
         $c2 = \Cookie::forget('list_cid');
         return \Theme::display('lists.list-remove', ['list' => $list], array($c1, $c2));
     }
     // dfault page
     // @todo set up a way of searching email addresses and unsubsribing them.
     return \Theme::display('lists.list-subscriptions', []);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::only('first_name', 'last_name', 'website', 'email', 'username', 'password', 'status', 'domain_id');
     $domain_id = Request::segment(3) ? Request::segment(3) : 'NULL';
     $rules = array('first_name' => 'required|min:1', 'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'username' => 'required|min:3|must_alpha_num|unique:users,username,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'password' => 'required|min:6');
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => 'users/add/' . Request::segment(3), 'errors' => $v, 'input' => TRUE));
     }
     $profile = new Profile(array('first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'website' => $input['website']));
     $profile->save();
     $user = new User(array('domain_id' => Request::segment(3) ? Request::segment(3) : NULL, 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), 'status' => $input['status']));
     $user->profile()->associate($profile);
     $user->save();
     $path = Request::segment(3) ? 'domain/users/' . Request::segment(3) : 'managers';
     if ($user->id) {
         if ($user->status == 4) {
             $this->add_phone_number($user->id);
         }
         $cookie = Cookie::forget('rndext');
         Event::fire('logger', array(array('account_add', array('id' => $user->id, 'username' => $user->username), 2)));
         //			return Output::push(array(
         //				'path' => $path,
         //				'messages' => array('success' => _('You have added user successfully')),
         //				));
         return Redirect::to($path)->with('success', _('You have added user successfully'))->withCookie($cookie);
     } else {
         return Output::push(array('path' => 'users', 'messages' => array('fail' => _('Fail to add user')), 'input' => TRUE));
     }
 }
Exemple #25
0
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    //
});
Route::group(['middleware' => 'web'], function () {
    Cookie::forget('laravel_session');
    Route::auth();
    //Route::get('/home', 'HomeController@index');
    Route::get('/login', function () {
        Auth::logout();
        return view('auth/login');
    });
    Route::get('/user', 'HomeController@index');
    Route::get('/moderator', 'HomeController@mod');
    Route::post('/user', function (Request $request) {
        $php = new Code();
        $php->email = Auth::user()->email;
        $php->code = $request->phpcode;
        $php->save();
        return view('home', ['code' => $request->phpcode]);
    });
Exemple #26
0
        get('access-catalog', 'DashboardController@accessCatalog');
    });
    Route::group(['prefix' => 'manage'], function () {
        get('student', 'DashboardController@student');
        get('faculty', 'DashboardController@faculty');
        get('librarian', 'DashboardController@librarian');
    });
    Route::group(['prefix' => 'display'], function () {
        get('change-password', 'DisplayController@changePassword');
    });
    get('/', 'DashboardController@index');
    get('category', 'DashboardController@category');
    get('dashboard', 'DashboardController@dashboard');
    get('login', 'AuthController@login');
    get('logout', function () {
        $cookie = Cookie::forget('access_token');
        return redirect('admin/login')->withCookie($cookie);
    });
});
Route::group(['namespace' => 'Guest'], function () {
    Route::group(['namespace' => 'Library'], function () {
        get('/', 'LibraryController@index');
        get('search', 'LibraryController@search_');
        get('guidelines', 'LibraryController@guidelines_');
        get('about', 'LibraryController@about_');
        get('contact', 'LibraryController@contact_');
        get('studentdashboard', 'LibraryController@studentdash_');
        get('facultydashboard', 'LibraryController@facultydash_');
        get('librariandashboard', 'LibraryController@librariandash_');
    });
});
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postStore($data = null)
 {
     $input = Request::segment(1) == 'phone_number' ? Input::only('description', 'sip_password', 'user_id') : $data;
     $input['extension'] = Cookie::get('rndext') ? Cookie::get('rndext') : $this->generate_extension();
     $path = Request::segment(2) == 'manage' ? "phone_number/manage/" . Request::segment(3) : "phone_number";
     $rules = array('extension' => 'unique:phone_numbers,extension,NULL,id,deleted_at,NULL', 'sip_password' => 'required|min:6|alpha_num');
     if (Request::segment(2) == 'manage') {
         $rules['user_id'] = 'required';
     }
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => $path . '/add', 'errors' => $v, 'input' => TRUE));
     }
     $phone_number = new PhoneNumber(['user_id' => $input['user_id'] ? $input['user_id'] : Auth::user()->id, 'extension' => $input['extension'], 'sip_password' => $input['sip_password'], 'description' => $input['description']]);
     $phone_number->save();
     Event::fire('logger', array(array('phone_number_add', array('id' => $phone_number->id, 'extension' => $input['extension']), 2)));
     if ($phone_number->id) {
         $cookie = Cookie::forget('rndext');
         $user = $input['user_id'] ? User::find($input['user_id']) : Auth::user();
         $data = array('phone_number_e164' => '+' . Config::get('settings.global_prefix') . '-' . $user->domain->prefix . '-' . $input['extension'], 'local_phone_number' => $input['extension'], 'domain_sip_server' => $user->domain->sip_server, 'domain_control_panel' => $user->domain->domain, 'sip_password' => $input['sip_password']);
         $mail_to = $input['user_id'] ? User::find($input['user_id'])->email : Auth::user()->email;
         Mail::send('emails.phone_number', $data, function ($message) use($mail_to) {
             $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'))->to($mail_to)->subject(_('New phone number'));
         });
         return Redirect::to($path)->with('success', _('You have added Phone Number successfully'))->withCookie($cookie);
     } else {
         return Output::push(array('path' => $path . '/add', 'messages' => array('fail' => _('Fail to add Phone Number')), 'input' => TRUE));
     }
 }
 function delete_cookies()
 {
     Cookie::queue(Cookie::forget('uid'));
     Cookie::queue(Cookie::forget('token'));
 }
Exemple #29
0
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', 'HomeController@getIndex');
// Utility Routes
Route::get('/launch', array('as' => 'launch', 'uses' => 'LaunchController@getIndex'));
Route::get('/login', array('as' => 'login', 'uses' => 'LaunchController@getLogin'));
Route::get('/blog', array('as' => 'blog', 'uses' => 'BlogController@getIndex'));
Route::get('/admin', array('as' => 'admin', 'uses' => 'AdminController@getIndex'));
Route::get('/portal', array('as' => 'portal', 'uses' => 'PortalController@getIndex'));
Route::get('/portal/post/new', array('uses' => 'PortalController@getPostCreate'));
Route::get('/{user}/{year}/{month}/{day}/{term}', 'BlogController@getPost');
Route::get('/blog/tag/{tag}', 'BlogController@getPostsByTag');
Route::get('/offender/{id}', 'OffenderController@getOffender');
// Utility Routes
Route::any('/logout', function () {
    Session::flush();
    $delCookie = Cookie::forget('_user_remember');
    return Response::view('login')->withCookie($delCookie);
});
// Core Routes
Route::get('/password', array('as' => 'Password', 'uses' => 'LaunchController@getPassword'));
Route::get('/forgot', array('as' => 'Forget', 'uses' => 'LaunchController@getForgot'));
// Custom Controllers
Route::controller('/launch', 'LaunchController');
Route::controller('/blog', 'BlogController');
Route::controller('/admin', 'AdminController');
Route::controller('/portal', 'PortalController');
Route::controller('/connection', 'ConnectionController');
Exemple #30
0
 /**
  * Log the current user out of the application.
  *
  * @return void
  */
 public static function logout()
 {
     // We will call the "logout" closure first, which gives the developer
     // the chance to do any clean-up or before the user is logged out of
     // the application. No action is taken by default.
     call_user_func(Config::get('auth.logout'), static::user());
     static::$user = null;
     $config = Config::get('session');
     extract($config, EXTR_SKIP);
     // When forgetting the cookie, we need to also pass in the path and
     // domain that would have been used when the cookie was originally
     // set by the framework, otherwise it will not be deleted.
     $cookie = Config::get('auth.cookie');
     Cookie::forget($cookie, $path, $domain, $secure);
     Session::forget(Auth::user_key);
 }