本文整理汇总了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);
}
}
示例2: intend
function intend()
{
if (Auth::check()) {
return Redirect::to(Input::get('vataware_callback'));
} else {
return Redirect::guest(URL::route('user.login'));
}
}
示例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');
}
示例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');
}
}
示例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);
}
示例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');
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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'));
}
}
});
示例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();
示例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('/');
示例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");
}
//
}
});
示例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.
|