FIX: fix minor bug in user management

This commit is contained in:
Michal Kváček
2017-08-02 13:52:19 +02:00
parent a4c020daa0
commit 3d73bffa6e
5 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ class UserRoles extends BaseEnumeration
{
$roles = [
User::ROLE_ADMIN => 'admin/userManagement.role_' . User::ROLE_ADMIN,
User::ROLE_EDITOR => 'admin/userManagement.role_' . User::ROLE_EDITOR,
// User::ROLE_EDITOR => 'admin/userManagement.role_' . User::ROLE_EDITOR,
User::ROLE_VISITOR => 'admin/userManagement.role_' . User::ROLE_VISITOR
];
@@ -39,7 +39,7 @@ class EditUser extends Controller
public function getEditUser(User $user = null)
{
// when no user specified, lets assume we want to edit "me"
if (!$user->exists()) {
if (!$user->exists) {
$user = Auth::user();
}
@@ -25,10 +25,11 @@ class UserDetail extends Controller
public function getDetail(User $user = null)
{
// when no user specified, lets assume we want to edit "me"
if (!$user->exists()) {
$id = Auth::user();
if (!$user->exists) {
$user = Auth::user();
}
$actions = $this->log->getUserActions($user->id, 10);
$roles = UserRoles::getWithTranslations();
$states = UserStates::getWithTranslations();
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
class LoginController extends Controller
{
+2 -3
View File
@@ -20,7 +20,7 @@ class Authenticate
public function handle($request, Closure $next, $guard = null)
{
if (!Auth::guard($guard)
->check() || Auth::user()->status != User::STATE_ACTIVE || Auth::user()->role == User::ROLE_VISITOR) {
->check() || Auth::user()->status != User::STATE_ACTIVE || Auth::user()->role == User::ROLE_VISITOR || 0) {
Auth::logout();
if ($request->ajax()) {
@@ -38,8 +38,7 @@ class Authenticate
return redirect()
->route('login')
->with('warning', trans($message))
->with('redirectTo', $request->fullUrl());
->with('warning', trans($message));
}
return $next($request);