public function setRegisterAttributes($roleId, $status = null)
    {
        // set default attributes
        $attributes = [
            "role_id" => $roleId,
            "created_ip" => Yii::$app->request->userIP,
            "auth_key" => Yii::$app->security->generateRandomString(),
            "access_token" => Yii::$app->security->generateRandomString(),
            "status" => static::STATUS_ACTIVE,
        ];

        // determine if we need to change status based on module properties
        $emailConfirmation = $this->module->emailConfirmation;
        $requireEmail = $this->module->requireEmail;
        $useEmail = $this->module->useEmail;
        if ($status) {
            $attributes["status"] = $status;
        } elseif ($emailConfirmation && $requireEmail) {
            $attributes["status"] = static::STATUS_INACTIVE;
        } elseif ($emailConfirmation && $useEmail && $this->email) {
            $attributes["status"] = static::STATUS_UNCONFIRMED_EMAIL;
        }

        // set attributes and return
        $this->setAttributes($attributes, false);
        return $this;
    }
public function setRegisterAttributes($roleId, $status = null)
    {
        // set default attributes
        $attributes = [
            "role_id" => $roleId,
            "created_ip" => Yii::$app->request->userIP,
            "auth_key" => Yii::$app->security->generateRandomString(),
            "access_token" => Yii::$app->security->generateRandomString(),
            "status" => static::STATUS_ACTIVE,
        ];

        // determine if we need to change status based on module properties
        $emailConfirmation = $this->module->emailConfirmation;
        $requireEmail = $this->module->requireEmail;
        $useEmail = $this->module->useEmail;
        if ($status) {
            $attributes["status"] = $status;
        } elseif ($emailConfirmation && $requireEmail) {
            $attributes["status"] = static::STATUS_INACTIVE;
        } elseif ($emailConfirmation && $useEmail && $this->email) {
            $attributes["status"] = static::STATUS_UNCONFIRMED_EMAIL;
        }

        // set attributes and return
        $this->setAttributes($attributes, false);
        return $this;
    }
public function setRegisterAttributes ( $ roleId , $ status = null ) { // set default attributes $ attributes = [ "role_id" => $ roleId , "created_ip" => Yii :: $ app -> request -> userIP , "auth_key" => Yii :: $ app -> security -> generateRandomString ( ) , "access_token" => Yii :: $ app -> security -> generateRandomString ( ) , "status" => static :: STATUS_ACTIVE , ] ; // determine if we need to change status based on module properties $ emailConfirmation = $ this -> module -> emailConfirmation ; $ requireEmail = $ this -> module -> requireEmail ; $ useEmail = $ this -> module -> useEmail ; if ( $ status ) { $ attributes [ "status" ] = $ status ; } elseif ( $ emailConfirmation && $ requireEmail ) { $ attributes [ "status" ] = static :: STATUS_INACTIVE ; } elseif ( $ emailConfirmation && $ useEmail && $ this -> email ) { $ attributes [ "status" ] = static :: STATUS_UNCONFIRMED_EMAIL ; } // set attributes and return $ this -> setAttributes ( $ attributes , false ) ; return $ this ; }
Set attributes for registration
@param int $roleId
@param string $status
@return static
Set attributes for registration