mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -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.notes',
|
||||
'users.company_id',
|
||||
'users.last_login',
|
||||
'users.deleted_at',
|
||||
'users.activated'
|
||||
])->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',
|
||||
'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';
|
||||
|
|
|
@ -156,10 +156,16 @@ class LoginController extends Controller
|
|||
LOG::debug("Local authentication failed.");
|
||||
return redirect()->back()->withInput()->with('error', trans('auth/message.account_not_found'));
|
||||
} else {
|
||||
|
||||
$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
|
||||
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,
|
||||
'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'),
|
||||
'last_login' => Helper::getFormattedDateObject($user->last_login, 'datetime'),
|
||||
];
|
||||
|
||||
$permissions_array['available_actions'] = [
|
||||
|
|
|
@ -176,6 +176,15 @@ class UserPresenter extends Presenter
|
|||
"visible" => false,
|
||||
'formatter' => 'dateDisplayFormatter'
|
||||
],
|
||||
[
|
||||
"field" => "last_login",
|
||||
"searchable" => false,
|
||||
"sortable" => true,
|
||||
"switchable" => true,
|
||||
"title" => trans('general.last_login'),
|
||||
"visible" => false,
|
||||
'formatter' => 'dateDisplayFormatter'
|
||||
],
|
||||
[
|
||||
"field" => "actions",
|
||||
"searchable" => false,
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
'insufficient_permissions' => 'Insufficient permissions!',
|
||||
'language' => 'Language',
|
||||
'last' => 'Last',
|
||||
'last_login' => 'Last Login',
|
||||
'last_name' => 'Last Name',
|
||||
'license' => 'License',
|
||||
'license_report' => 'License Report',
|
||||
|
|
Loading…
Reference in a new issue