fix: [Workflow:UserBeforeSave] Ignore workflow execution for logins and logouts

pull/8530/head
Sami Mokaddem 2022-06-24 15:48:50 +02:00
parent 8bc91d53d5
commit 0a478bfda0
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 8 additions and 2 deletions

View File

@ -280,8 +280,14 @@ class User extends AppModel
'id' => $user_id,
'message' => __('The workflow `%s` prevented the saving of user %s', $trigger_id, $user_id),
];
$success = $this->executeTrigger($trigger_id, $user['User'], $workflowErrors, $logging);
return !empty($success);
if (
$user['User']['action'] != 'logout' &&
$user['User']['action'] != 'login'
) {
$success = $this->executeTrigger($trigger_id, $user['User'], $workflowErrors, $logging);
return !empty($success);
}
return true;
}
public function afterSave($created, $options = array())