femanager
femanager copied to clipboard
Autogenerate Password not working in CreateUserNotifyEmail
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']);
}
} `
During tests I didn't get any password in a mail. If this option is configured, the user doesn't get the information about his automatically generated password. Is that intended?
If a user is generated with password, the user is able to reset the password. This is used f.e. if you invite users. This feature is barely used (as far as I know), so I won't set priority at it.