Commit 1c7f767a authored by Nicolas Widart's avatar Nicolas Widart

Merge commit 'b7a4a21b'

* commit 'b7a4a21b':
  Squashed 'Modules/User/' changes from 3b77eb6..9ef6f40
parents d1afd6fc b7a4a21b
<?php namespace Modules\User\Commands;
use Cartalyst\Sentinel\Laravel\Facades\Reminder;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Event;
use Laracasts\Commander\CommandHandler;
use Modules\User\Events\UserHasBegunResetProcess;
......
<?php namespace Modules\User\Commands;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Event;
use Laracasts\Commander\CommandHandler;
use Modules\User\Events\UserHasRegistered;
......
......@@ -42,7 +42,7 @@ class AuthController
$error = $this->auth->login($credentials, $remember);
if (!$error) {
Flash::success('Successfully logged in.');
return Redirect::route('dashboard.index');
return Redirect::intended('/');
}
Flash::error($error);
......
<?php namespace Modules\User\Http\Filters;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Routing\Redirector;
use Modules\Core\Contracts\Authentication;
class GuestFilter
{
/**
* @var Authentication
*/
private $auth;
/**
* @var Redirector
*/
private $redirect;
public function __construct(Authentication $auth, Redirector $redirect)
{
$this->auth = $auth;
$this->redirect = $redirect;
}
public function filter()
{
if (Sentinel::check()) {
return Redirect::route('dashboard.index');
if ($this->auth->check()) {
return $this->redirect->route('dashboard.index');
}
}
}
......@@ -116,4 +116,13 @@ class SentinelAuthentication implements Authentication
{
return Sentinel::hasAccess($permission);
}
/**
* Check if the user is logged in
* @return mixed
*/
public function check()
{
return Sentinel::check();
}
}
......@@ -32,14 +32,14 @@
<div class="col-sm-6">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('user::roles.form.name')) !!}
{!! Form::text('name', Input::old('name'), ['class' => 'form-control', 'placeholder' => trans('user::roles.form.name')]) !!}
{!! Form::text('name', Input::old('name'), ['class' => 'form-control slugify', 'placeholder' => trans('user::roles.form.name')]) !!}
{!! $errors->first('name', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group{{ $errors->has('slug') ? ' has-error' : '' }}">
{!! Form::label('slug', trans('user::roles.form.slug')) !!}
{!! Form::text('slug', Input::old('slug'), ['class' => 'form-control', 'placeholder' => trans('user::roles.form.slug')]) !!}
{!! Form::text('slug', Input::old('slug'), ['class' => 'form-control slug', 'placeholder' => trans('user::roles.form.slug')]) !!}
{!! $errors->first('slug', '<span class="help-block">:message</span>') !!}
</div>
</div>
......
......@@ -35,14 +35,14 @@
<div class="col-sm-6">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('user::roles.form.name')) !!}
{!! Form::text('name', Input::old('name', $role->name), ['class' => 'form-control', 'placeholder' => trans('user::roles.form.name')]) !!}
{!! Form::text('name', Input::old('name', $role->name), ['class' => 'form-control slugify', 'placeholder' => trans('user::roles.form.name')]) !!}
{!! $errors->first('name', '<span class="help-block">:message</span>') !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group{{ $errors->has('slug') ? ' has-error' : '' }}">
{!! Form::label('slug', trans('user::roles.form.slug')) !!}
{!! Form::text('slug', Input::old('slug', $role->slug), ['class' => 'form-control', 'placeholder' => trans('user::roles.form.slug')]) !!}
{!! Form::text('slug', Input::old('slug', $role->slug), ['class' => 'form-control slug', 'placeholder' => trans('user::roles.form.slug')]) !!}
{!! $errors->first('slug', '<span class="help-block">:message</span>') !!}
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment