Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
#786483
Dear all,
When using the PM Function PMFCreateUser(), is there any way to force the new created user to change its password on the first login?
Do we have any other way of creating users in the platform using trigger which forces it?

Regards
#786574
amosbatto wrote:Mark the checkbox in the user's profile to force him/her to change the password:
ForceUserToChangePassword.png
Hi Amos,
We were creating the user with the PM Function, not by the User Interface. Setting the value one by one is not affordable.

Regards
#786576
Jose,
Oh I see what you want. You can use this code to set this in the database:
Code: Select all
$newUsername = 'jsmith';
$result = PMFCreateUser($newUsername, 'PaSsWoRd', 'John', 'Smith', 'jsmith@company.com', 'PROCESSMAKER_OPERATOR');
if ($result) {
   $sql = "SELECT USR_UID FROM USERS WHERE USR_USERNAME='$newUsername'";
   $aUser = executeQuery($sql) or die("Unable to query the new user's record.");
   $userId = $aUser[1]['USR_UID'];
   $sql = "UPDATE USER_PROPERTIES SET  USR_LOGGED_NEXT_TIME=1 WHERE USR_UID='$userId' ";
   $res = executeQuery($sql) or die("Unable to update the new user's record.");
 }
Then, the user will be forced to change the password on the first login. Let me know if this works and I will add the example to the wiki.
#786619
amosbatto wrote:Jose,
Oh I see what you want. You can use this code to set this in the database:
Code: Select all
$newUsername = 'jsmith';
$result = PMFCreateUser($newUsername, 'PaSsWoRd', 'John', 'Smith', 'jsmith@company.com', 'PROCESSMAKER_OPERATOR');
if ($result) {
   $sql = "SELECT USR_UID FROM USERS WHERE USR_USERNAME='$newUsername'";
   $aUser = executeQuery($sql) or die("Unable to query the new user's record.");
   $userId = $aUser[1]['USR_UID'];
   $sql = "UPDATE USER_PROPERTIES SET  USR_LOGGED_NEXT_TIME=1 WHERE USR_UID='$userId' ";
   $res = executeQuery($sql) or die("Unable to update the new user's record.");
 }
Then, the user will be forced to change the password on the first login. Let me know if this works and I will add the example to the wiki.
Thank you, this worked for us. However, when you create a new user with PMFCreateUser it does not update USERS_PROPERTIES, so I had to use an INSERT instead of an UPDATE.

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]