当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::guest方法代码示例

本文整理汇总了PHP中Redirect::guest方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::guest方法的具体用法?PHP Redirect::guest怎么用?PHP Redirect::guest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Redirect的用法示例。


在下文中一共展示了Redirect::guest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postLogin

 public function postLogin()
 {
     if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')))) {
         return Redirect::intended(route('admin.home'));
     } else {
         return Redirect::guest('login')->withInput()->with('login_errors', true);
     }
 }
开发者ID:ddcint,项目名称:benefund,代码行数:8,代码来源:AuthController.php

示例2: intend

 function intend()
 {
     if (Auth::check()) {
         return Redirect::to(Input::get('vataware_callback'));
     } else {
         return Redirect::guest(URL::route('user.login'));
     }
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:8,代码来源:AuthController.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         if ($this->auth->user()->type == 'admin') {
             return $next($request);
         }
         abort(403, 'Unauthorized action.');
     }
     return \Redirect::guest('auth/login');
 }
开发者ID:4unkur,项目名称:college-website,代码行数:17,代码来源:AdminAuthentication.php

示例4: filter

 /**
  * Main filter function triggered by laravel
  * Here we will trigger our role/route check also do the 
  * standard auth check here so that we dont need to add 
  * more filter parameters to our routes
  * @todo find where we should go when we dont have access
  * @return Response
  */
 public function filter()
 {
     // Heres the implementation of the default auth filter
     // All routes using the Role Manager needs the auth object instance
     // to look up rights for the users
     // In the redirect page we can do a Auth::guest() check to see if the user
     // are logged in or not. If the user are logged in we can show a warning that he/she
     // does not have the rights required to view the page / take the action
     if (!\Role::hasAccess()) {
         return \Redirect::guest('login');
     }
 }
开发者ID:leitom,项目名称:role,代码行数:20,代码来源:Role.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             //return redirect()->guest('auth/login');
             return \Redirect::guest(\URL::route('account-sign-in'));
         }
     }
     return $next($request);
 }
开发者ID:TraianAlex,项目名称:laravel2,代码行数:19,代码来源:Authenticate.php

示例6: postLogin

 public function postLogin()
 {
     $cred = array('username' => \Input::get('username'), 'password' => \Input::get('password'));
     if (\Auth::attempt($cred)) {
         return \Redirect::intended('/');
     } else {
         return \Redirect::guest('login');
     }
     //$creds = array('username' => 'hasan' , 'password' => 'abc');
     //\Auth::attempt($creds);
     //Redirect::to('users');
 }
开发者ID:hassantariq29,项目名称:app,代码行数:12,代码来源:HomeController.php

示例7: checkPermission

 public static function checkPermission($controller_type, $controller_id = null, $message = "You do not have permission to do that.")
 {
     $perm = self::getPermission($controller_type, $controller_id);
     if ($perm->result === false) {
         //we can redirect!
         if ($message) {
             return Redirect::guest(config('bootlegcms.cms_route') . 'login')->with('danger', $message);
         } else {
             return Redirect::guest(config('bootlegcms.cms_route') . 'login');
         }
     } else {
         return true;
     }
 }
开发者ID:ryzr,项目名称:bootlegcms,代码行数:14,代码来源:Permission.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  * @param string                   $role
  * @return mixed
  * @throws AuthenticationException
  */
 public function handle($request, Closure $next, $role = 'guest')
 {
     if (\Auth::guest()) {
         //Guests should be redirected to the login page as we make some links visible
         if (\Request::ajax()) {
             return \Response::make('Unauthorized', 401);
         } else {
             return \Redirect::guest('login');
         }
     } elseif ($role !== 'member' && !\Auth::user()->hasRole($role)) {
         throw new AuthenticationException();
     } elseif (\Auth::user()->isBanned()) {
         throw new AuthenticationException();
     }
     return $next($request);
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:25,代码来源:HasRole.php

示例9: onRun

 /**
  * Executed when this component is bound to a page or layout.
  */
 public function onRun()
 {
     $this->setProperty('security', self::ALLOW_USER);
     if ($redirect = parent::onRun()) {
         return $redirect;
     }
     /** @var $user User */
     $user = $this->page['user'];
     $redirectUrl = $this->controller->pageUrl($this->property('redirect'));
     $allowedGroup = $this->property('group', null);
     $group = UserGroup::where('id', $allowedGroup);
     if (!$group || !$user->inGroup($group)) {
         return Redirect::guest($redirectUrl);
     }
     $this->page['group'] = $group;
 }
开发者ID:gabsource,项目名称:usergroup-plugin,代码行数:19,代码来源:SessionGroup.php

示例10: sendCurlRequestToURL

 protected function sendCurlRequestToURL($url, $data, $custom_request = "POST")
 {
     if (date(time()) >= Session::get('oauth_token_expiry')) {
         $this->refreshAccessToken();
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $custom_request);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . Session::get('access_token'), 'Content-Type: application/json', 'Content-Length: ' . strlen($data)]);
     curl_setopt($ch, CURLOPT_URL, $url);
     $result = json_decode(curl_exec($ch), true);
     curl_close($ch);
     if (isset($result['error'])) {
         return Redirect::guest('login');
     }
     return $result;
 }
开发者ID:adrielpdeguzman,项目名称:chainofmemories_gui,代码行数:19,代码来源:BaseController.php

示例11: function

<?php

Route::filter('admin.auth', function () {
    if (AdminAuth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        } else {
            return Redirect::guest(Admin::instance()->router->routeToAuth('login'));
        }
    }
});
开发者ID:GlobalsDD,项目名称:admin,代码行数:11,代码来源:filters.php

示例12: function

Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function () {
    if (!Sentry::check()) {
        return Redirect::guest('login')->with('errorMessage', 'Silahkan login terlebih dulu');
    }
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() != Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
开发者ID:inseo201,项目名称:surat-mahaiswa,代码行数:31,代码来源:filters.php

示例13: list

    }
    list($class, $permission) = explode('_', $value);
    try {
        $user = Sentry::getUser();
        // todo add more generic check in here to lookup access based on resource ID
        if ($user->hasAccess($value) || $user->hasAccess(Permissions::name($class, 'admin'))) {
            return;
        }
        Session::flash('error', trans('users.noaccess'));
        return Redirect::route('home');
    } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
        Session::flash('error', trans('users.notfound'));
        return Redirect::guest('login');
    } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
        Session::flash('error', trans('groups.notfound'));
        return Redirect::guest('login');
    }
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function () {
    if (Auth::check()) {
        return Redirect::to('/');
开发者ID:jeanfrancis,项目名称:faxbox,代码行数:31,代码来源:filters.php

示例14: function

<?php

Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        }
        return Redirect::guest('/');
    }
    $return = 0;
    foreach (Auth::user()->groups as $group) {
        foreach ($group->resources as $resource) {
            if ($resource->pattern == "/" . Route::getCurrentRoute()->getPath()) {
                $return = 1;
            }
        }
    }
    if ($return == 0) {
        return Redirect::to('/profile');
    } else {
        return;
    }
});
Route::filter("guest", function () {
    if (Auth::check()) {
        if (Route::getCurrentRoute()->getPath() == "login") {
            return Redirect::route("user/profile");
        }
        //
    }
});
开发者ID:alejandromorg,项目名称:Inventario,代码行数:31,代码来源:filters.php

示例15: function

/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        } else {
            return Redirect::guest(URL::route('account-login'));
        }
    }
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
开发者ID:mlauren,项目名称:midway-gallery,代码行数:31,代码来源:filters.php


注:本文中的Redirect::guest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。