This commit is contained in:
Andrea Adamczyk
2019-07-05 16:00:43 -04:00
parent a07867510d
commit 448e0722fa
7 changed files with 196 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Str;
use ProcessMaker\Model\User;
/**
* We will send a case note in the actions by email
@@ -493,3 +494,29 @@ if (!function_exists('set_magic_quotes_runtime')) {
return false;
}
}
/**
* Update the USER table with the last login date
*
* @param array $userLog
* @return int
* @throws Exception
*
* @see workflow/engine/methods/login/authentication.php
*/
function updateUserLastLogin($userLog, $keyLastLogin = 'LOG_INIT_DATE')
{
try {
$filters = [];
$filters['USR_UID'] = $userLog['USR_UID'];
$user = User::query();
$user->userFilters($filters);
$res = $user->update(['USR_LAST_LOGIN' => $userLog[$keyLastLogin]]);
return $res;
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}