- Дописаны дополнительные условия проверки передаемых параметров. email теперь...

- Дописаны дополнительные условия проверки передаемых параметров. email теперь определяется одним из двух возможных способов, получением его через params или через message
parent 22c3679b
......@@ -25,11 +25,19 @@ class CheckUserToRegistration extends ConditionBase implements ConditionInterfac
* @param $message
* @return bool
*/
public function check($message){
$user = User::find()->where(['email' => $message->email])->one();
if (!is_null($user)) {
$exists = TriggerLogs::find()->where(['user_id' => $user->getPrimaryKey(), 'action' =>TriggerLogs::USER_REGISTRATION])->exists();
return $exists;
public function check($message=null, $params = array()){
$email = null;
if (!is_null($message))
$email = $message->email;
elseif(array_key_exists('email', $params)) {
$email = $params['email'];
}
if (!is_null($email)) {
$user = User::find()->where(['email' => $email])->one();
if (!is_null($user)) {
$exists = TriggerLogs::find()->where(['user_id' => $user->getPrimaryKey(), 'action' =>TriggerLogs::USER_REGISTRATION])->exists();
return $exists;
}
}
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment