Merge remote-tracking branch 'origin/release/3.3.9' into bugfix/PMC-580
This commit is contained in:
@@ -411,7 +411,7 @@ class ActionsByEmail
|
||||
'',
|
||||
'',
|
||||
'pending',
|
||||
'',
|
||||
1,
|
||||
'',
|
||||
false,
|
||||
isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : 0,
|
||||
|
||||
@@ -2005,4 +2005,111 @@ class User
|
||||
return $isSupervisor;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* It changes the password of the user specified by its identifier, optionally
|
||||
* the value of $userLang can be sent, otherwise the system value is taken.
|
||||
* In case of success, the updated user returns.
|
||||
*
|
||||
* @global object $RBAC
|
||||
* @param string $usrUid
|
||||
* @param string $usrPassword
|
||||
* @param string $userLang
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @see workflow/engine/methods/login/authentication.php
|
||||
* @see workflow/engine/methods/login/changePassword.php
|
||||
* @link https://wiki.processmaker.com/3.0/Managing_Users#Creating_New_Users
|
||||
*/
|
||||
public function changePassword($usrUid, $usrPassword, $userLang = "")
|
||||
{
|
||||
global $RBAC;
|
||||
|
||||
$users = new Users();
|
||||
$user = $users->load($usrUid);
|
||||
|
||||
$data = [];
|
||||
$data['USR_UID'] = $user['USR_UID'];
|
||||
$data['USR_USERNAME'] = $user['USR_USERNAME'];
|
||||
$data['USR_PASSWORD'] = Bootstrap::hashPassword($usrPassword);
|
||||
$data['USR_FIRSTNAME'] = $user['USR_FIRSTNAME'];
|
||||
$data['USR_LASTNAME'] = $user['USR_LASTNAME'];
|
||||
$data['USR_EMAIL'] = $user['USR_EMAIL'];
|
||||
$data['USR_DUE_DATE'] = $user['USR_DUE_DATE'];
|
||||
$data['USR_UPDATE_DATE'] = date('Y-m-d H:i:s');
|
||||
|
||||
$RBAC->updateUser($data, $user['USR_ROLE']);
|
||||
|
||||
$data['USR_COUNTRY'] = $user['USR_COUNTRY'];
|
||||
$data['USR_CITY'] = $user['USR_CITY'];
|
||||
$data['USR_LOCATION'] = $user['USR_LOCATION'];
|
||||
$data['USR_ADDRESS'] = $user['USR_ADDRESS'];
|
||||
$data['USR_PHONE'] = $user['USR_PHONE'];
|
||||
$data['USR_ZIP_CODE'] = $user['USR_ZIP_CODE'];
|
||||
$data['USR_POSITION'] = $user['USR_POSITION'];
|
||||
|
||||
$users->update($data);
|
||||
|
||||
$usersProperties = new UsersProperties();
|
||||
$userProperty = $usersProperties->load($usrUid);
|
||||
$history = unserialize($userProperty['USR_PASSWORD_HISTORY']);
|
||||
|
||||
if (!is_array($history)) {
|
||||
$history = [];
|
||||
}
|
||||
|
||||
if (!defined('PPP_PASSWORD_HISTORY')) {
|
||||
define('PPP_PASSWORD_HISTORY', 0);
|
||||
}
|
||||
|
||||
if (PPP_PASSWORD_HISTORY > 0) {
|
||||
if (count($history) >= PPP_PASSWORD_HISTORY) {
|
||||
array_shift($history);
|
||||
}
|
||||
$history[] = $usrPassword;
|
||||
}
|
||||
|
||||
$userProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
|
||||
$userProperty['USR_LOGGED_NEXT_TIME'] = 0;
|
||||
$userProperty['USR_PASSWORD_HISTORY'] = serialize($history);
|
||||
|
||||
$usersProperties->update($userProperty);
|
||||
|
||||
if (class_exists('redirectDetail')) {
|
||||
|
||||
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
|
||||
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
|
||||
}
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
|
||||
$redirectLogin = $pluginRegistry->getRedirectLogins();
|
||||
if (isset($redirectLogin)) {
|
||||
if (is_array($redirectLogin)) {
|
||||
foreach ($redirectLogin as $detail) {
|
||||
if (isset($detail->sPathMethod)) {
|
||||
if ($detail->equalRoleCodeTo($userRole)) {
|
||||
$user['__REDIRECT_PATH__'] = '/sys' . config('system.workspace') . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->getPathMethod();
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lang = "";
|
||||
if ($userLang !== "") {
|
||||
$lang = $userLang;
|
||||
} else {
|
||||
if (defined('SYS_LANG')) {
|
||||
$lang = SYS_LANG;
|
||||
} else {
|
||||
$lang = 'en';
|
||||
}
|
||||
}
|
||||
$location = $usersProperties->redirectTo($usrUid, $lang);
|
||||
$user['__REDIRECT_PATH__'] = $location;
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user