FusionAuth sendSetPasswordEmail 在创建用户时不发送设置密码电子邮件

FusionAuth sendSetPasswordEmail not sending Set Password Email when creating a user

我想在不指定密码的情况下创建用户,并让 FusionAuth 发送设置密码电子邮件。我正在使用 PHP 客户端库,虽然我可以创建用户,但电子邮件未发送。但是,手动发送重置密码电子邮件已成功发送。

我已将 SMTP 设置配置为使用我的 Mailgun 帐户。

这是我通过客户端发送的内容;

$this->authClient->createUser(null, [
        'user' => [
            'active'               => true,
            'sendSetPasswordEmail' => true,
            'birthDate'            => '01/01/1990',
            'email'                => 'a.valid@email.co.uk',
            'firstName'            => 'John',
            'fullName'             => 'John Doe',
            'lastName'             => 'Doe',
            'middleName'           => '',
            'mobilePhone'          => +447777777777,
            'password'             => 'ForSomeReasonThisNEEDStoBeSet',
            'data'                 => [
                'identifier' => $someIdentifier
            ],
            'memberships'          => [
                ['groupId' => $myGroupId]
            ],
            'preferredLanguages'   => ['en'],
            'timezone'             => 'Europe/London',
            'twoFactorEnabled'     => false,
            'usernameStatus'       => 'ACTIVE',
            'username'             => $username,
            'verified'             => true
        ]
    ]);

即使我传递了 sendSetPasswordEmailpassword 字段仍然是必需的,但是文档表明情况不应该如此;

This field is optional only if sendSetPasswordEmail is set to true. By default sendSetPasswordEmail is false, and then this field will be required.

如何在创建用户时发送密码设置电子邮件?提前致谢

sendSetPasswordEmail 是 JSON 请求中的顶级值。您需要将其作为 user 对象的兄弟对象向上移动。

示例:

$this->authClient->createUser(null, [
        'sendSetPasswordEmail' => true,
        'user' => [
            'active'               => true,
            'birthDate'            => '01/01/1990',
            'email'                => 'a.valid@email.co.uk',
            'firstName'            => 'John',
            'fullName'             => 'John Doe',
            'lastName'             => 'Doe',
            'middleName'           => '',
            'mobilePhone'          => +447777777777,
            'password'             => 'ForSomeReasonThisNEEDStoBeSet',
            'data'                 => [
                'identifier' => $someIdentifier
            ],
            'memberships'          => [
                ['groupId' => $myGroupId]
            ],
            'preferredLanguages'   => ['en'],
            'timezone'             => 'Europe/London',
            'twoFactorEnabled'     => false,
            'usernameStatus'       => 'ACTIVE',
            'username'             => $username,
            'verified'             => true
        ]
    ]);

引用Create User API