Skip to content

Autogenerate Password not working in CreateUserNotifyEmail #260

Open
@pfuju

Description

@pfuju

Problem: After users confirmed there email addresses the user account will be set enabled and users are enabled to login.
An Email (CreateUserNotify) will be send to the user.

Using varibale {user.passwordAutoGenerated} will be always null because in UserUtility::fallbackUsernameAndPassword($user) the password will only be set if password === "". In this step the password will never be empty, because it is already set in the NewController::createAction().

May be there is a better solution in future for this behaviour?

Current workarround: Using BeforeUserConfirmEvent

`
use In2code\Femanager\Event\BeforeUserConfirmEvent;
use In2code\Femanager\Utility\UserUtility;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

class BeforeUserConfirmListener
{
public function __invoke(BeforeUserConfirmEvent $beforeUserConfirmEvent): void
{

    $user = $beforeUserConfirmEvent->getUser();
    $user->setPassword('');
    $user = UserUtility::fallbackUsernameAndPassword($user);
    UserUtility::hashPassword($user, $this->settings['new']['misc']['passwordSave']);

}

}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    sponsor itif you want this topic to be prioritized: https://github.com/sponsors/in2code-detype: bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions