mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Added last login to user menu
This commit is contained in:
parent
2b4443f810
commit
51fccbdda4
|
@ -36,6 +36,7 @@ class UsersController extends Controller
|
||||||
'users.created_at',
|
'users.created_at',
|
||||||
'users.notes',
|
'users.notes',
|
||||||
'users.company_id',
|
'users.company_id',
|
||||||
|
'users.last_login',
|
||||||
'users.deleted_at',
|
'users.deleted_at',
|
||||||
'users.activated'
|
'users.activated'
|
||||||
])->with('manager', 'groups', 'userloc', 'company', 'throttle','assets','licenses','accessories','consumables')
|
])->with('manager', 'groups', 'userloc', 'company', 'throttle','assets','licenses','accessories','consumables')
|
||||||
|
@ -67,7 +68,7 @@ class UsersController extends Controller
|
||||||
[
|
[
|
||||||
'last_name','first_name','email','jobtitle','username','employee_num',
|
'last_name','first_name','email','jobtitle','username','employee_num',
|
||||||
'assets','accessories', 'consumables','licenses','groups','activated','created_at',
|
'assets','accessories', 'consumables','licenses','groups','activated','created_at',
|
||||||
'two_factor_enrolled','two_factor_optin'
|
'two_factor_enrolled','two_factor_optin','last_login'
|
||||||
];
|
];
|
||||||
|
|
||||||
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
|
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
|
||||||
|
|
|
@ -156,10 +156,16 @@ class LoginController extends Controller
|
||||||
LOG::debug("Local authentication failed.");
|
LOG::debug("Local authentication failed.");
|
||||||
return redirect()->back()->withInput()->with('error', trans('auth/message.account_not_found'));
|
return redirect()->back()->withInput()->with('error', trans('auth/message.account_not_found'));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->clearLoginAttempts($request);
|
$this->clearLoginAttempts($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($user = Auth::user()) {
|
||||||
|
$user->last_login = \Carbon::now();
|
||||||
|
\Log::debug('Last login:'.$user->last_login);
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
// Redirect to the users page
|
// Redirect to the users page
|
||||||
return redirect()->intended()->with('success', trans('auth/message.signin.success'));
|
return redirect()->intended()->with('success', trans('auth/message.signin.success'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ class UsersTransformer
|
||||||
'company' => ($user->company) ? ['id' => $user->company->id,'name'=> e($user->company->name)] : null,
|
'company' => ($user->company) ? ['id' => $user->company->id,'name'=> e($user->company->name)] : null,
|
||||||
'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'),
|
'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'),
|
||||||
'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'),
|
'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'),
|
||||||
|
'last_login' => Helper::getFormattedDateObject($user->last_login, 'datetime'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$permissions_array['available_actions'] = [
|
$permissions_array['available_actions'] = [
|
||||||
|
|
|
@ -176,6 +176,15 @@ class UserPresenter extends Presenter
|
||||||
"visible" => false,
|
"visible" => false,
|
||||||
'formatter' => 'dateDisplayFormatter'
|
'formatter' => 'dateDisplayFormatter'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"field" => "last_login",
|
||||||
|
"searchable" => false,
|
||||||
|
"sortable" => true,
|
||||||
|
"switchable" => true,
|
||||||
|
"title" => trans('general.last_login'),
|
||||||
|
"visible" => false,
|
||||||
|
'formatter' => 'dateDisplayFormatter'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"field" => "actions",
|
"field" => "actions",
|
||||||
"searchable" => false,
|
"searchable" => false,
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
'insufficient_permissions' => 'Insufficient permissions!',
|
'insufficient_permissions' => 'Insufficient permissions!',
|
||||||
'language' => 'Language',
|
'language' => 'Language',
|
||||||
'last' => 'Last',
|
'last' => 'Last',
|
||||||
|
'last_login' => 'Last Login',
|
||||||
'last_name' => 'Last Name',
|
'last_name' => 'Last Name',
|
||||||
'license' => 'License',
|
'license' => 'License',
|
||||||
'license_report' => 'License Report',
|
'license_report' => 'License Report',
|
||||||
|
|
Loading…
Reference in a new issue