This bundle offers a lost password function for the backend of the Contao CMS.
- Never send new passwords to your customers again if they have forgotten their old ones. :-)
- After requesting a new password, a password reset link is sent to the user's email.
- Select a mailer transport for outgoing mails in the settings.
- Install via composer:
composer require heimrichhannot/contao-backend-lost-password-bundle
and update your database. - Set the
huh_backend_lost_password.add_to_template
to true if you want the lost password link automatically added to you backend login template.
# config/config.yml
huh_backend_lost_password:
add_to_template: true
You can use Notification Center to send the password request.
- Create a notification of type
User: Lost password
with##recipient_email##
as recipient and content that contains##link##
(the link to the password reset page). You can use additional token:##domain##
and user data withing##user_*##
. - Set the id of the notification in your project configuration in
huh_backend_lost_password.nc_notification
.
# config/config.yml
huh_backend_lost_password:
nc_notification: 5
You can insert the lost password link in a custom login template where you want by calling BackendLostPasswortManager->getLostPasswordLink()
.
<!-- ... -->
<div class="widget">
<label for="password"><?= $this->password ?></label>
<input type="password" name="password" id="password" class="tl_text" value="" placeholder="<?= $this->password ?>" required>
</div>
<?= System::getContainer()->get(\HeimrichHannot\BackendLostPasswordBundle\Manager\BackendLostPasswordManager::class)->getLostPasswordLink() ?>
<div class="submit_container cf">
<button type="submit" name="login" id="login" class="tl_submit"><?= $this->loginButton ?></button>
<a href="<?= $this->route('contao_root') ?>" class="footer_preview"><?= $this->feLink ?> ›</a>
</div>
<!-- ... -->
Hint: You can also set a notification center message by setting the id in your config.yml (see below).
Simply override the following $GLOBALS
entries:
$GLOBALS['TL_LANG']['MSC']['backendLostPassword']['messageSubjectResetPassword']
$GLOBALS['TL_LANG']['MSC']['backendLostPassword']['messageBodyResetPassword']
# Default configuration for extension with alias: "huh_backend_lost_password"
huh_backend_lost_password:
# If true, that backend lost password link will be automatically added to the backed login template. Default false. Will be true in the next major version!
add_to_template: false
# The numeric ID of the notification center notification which is sent for resetting the password.
nc_notification: false