Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderators: ArturoRobles, ArturoRobles

By Bosatzu
#825921
Hello everyone!

I just realize that the last login of the users do not update, but i don't know why.
login.png
login.png (156.38 KiB) Viewed 2726 times
Last edited by Bosatzu on Thu Aug 15, 2019 10:32 am, edited 1 time in total.
User avatar
By amosbatto
#825937
The login date updates for me in PM 3.3.14 Enterprise (manual install) in Debian 9.5, but there is no last login date listed for PM 3.3.10 Community (manual install) in Debian 9.5.

What is your setup?
User avatar
By amosbatto
#825968
The problem is that the Community Edition doesn't have the \ProcessMaker\Model\Users class which is used to update the last login date in the Enterprise Edition.

Here is how to fix it. Edit the file workflow/engine/methods/login/authentication.php and change line 307 from:
Code: Select all
    if ($RBAC->singleSignOn) {        
        G::header('Location: ' . $sLocation);
        die();
    }
To:
Code: Select all
    if ($RBAC->singleSignOn) {
        // Update the User's last login date:
        $u = new Users();
        $aUserProps = array(
           'USR_UID' => $aLog['USR_UID'],
           'USR_LAST_LOGIN' => $aLog['LOG_INIT_DATE']
        );
        $u->update($aUserProps);
        
        G::header('Location: ' . $sLocation);
        die();
    }


Then, change line 380 from:
Code: Select all
    if ($activeSession){
        setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
    }
    
    G::header('Location: ' . $sLocation);
To:
Code: Select all
    if ($activeSession){
        setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
    }
    
    // Update the User's last login date:
    $u = new Users();
    $aUserProps = array(
       'USR_UID' => $aLog['USR_UID'],
       'USR_LAST_LOGIN' => $aLog['LOG_INIT_DATE']
    );
    $u->update($aUserProps);

    $oPluginRegistry = PluginRegistry::loadSingleton();
    if ($oPluginRegistry->existsTrigger ( PM_AFTER_LOGIN )) {
        $oPluginRegistry->executeTriggers ( PM_AFTER_LOGIN , $_SESSION['USER_LOGGED'] );
    }

    G::header('Location: ' . $sLocation);

After making that code change, the last login date should appear:
LastLoginDateInUsersList.png
LastLoginDateInUsersList.png (63.45 KiB) Viewed 2688 times
By Bosatzu
#825997
amosbatto wrote: Tue Aug 13, 2019 11:15 pm The problem is that the Community Edition doesn't have the \ProcessMaker\Model\Users class which is used to update the last login date in the Enterprise Edition.

Here is how to fix it. Edit the file workflow/engine/methods/login/authentication.php and change line 307 from:
Code: Select all
    if ($RBAC->singleSignOn) {        
        G::header('Location: ' . $sLocation);
        die();
    }
To:
Code: Select all
    if ($RBAC->singleSignOn) {
        // Update the User's last login date:
        $u = new Users();
        $aUserProps = array(
           'USR_UID' => $aLog['USR_UID'],
           'USR_LAST_LOGIN' => $aLog['LOG_INIT_DATE']
        );
        $u->update($aUserProps);
        
        G::header('Location: ' . $sLocation);
        die();
    }


Then, change line 380 from:
Code: Select all
    if ($activeSession){
        setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
    }
    
    G::header('Location: ' . $sLocation);
To:
Code: Select all
    if ($activeSession){
        setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
    }
    
    // Update the User's last login date:
    $u = new Users();
    $aUserProps = array(
       'USR_UID' => $aLog['USR_UID'],
       'USR_LAST_LOGIN' => $aLog['LOG_INIT_DATE']
    );
    $u->update($aUserProps);

    $oPluginRegistry = PluginRegistry::loadSingleton();
    if ($oPluginRegistry->existsTrigger ( PM_AFTER_LOGIN )) {
        $oPluginRegistry->executeTriggers ( PM_AFTER_LOGIN , $_SESSION['USER_LOGGED'] );
    }

    G::header('Location: ' . $sLocation);

After making that code change, the last login date should appear:
LastLoginDateInUsersList.png

It works just perfect! thank you for your help.
cell phone jammer

A mobile phone jammer or blocker is a device which[…]

Hi all, I am using the bitnami stack for processm[…]

wifi jammer

As we all know that cell phones are strictly prohi[…]

Link to new dynaform

Cloud computing is powerful and expansive and will[…]