heimrichhannot / contao-backend-lost-password-bundle
This bundle offers a lost password function for the backend of the Contao CMS.
Installs: 2 550
Dependents: 1
Suggesters: 2
Security: 0
Stars: 3
Watchers: 7
Forks: 2
Open Issues: 0
Type:contao-bundle
Requires
- php: ^7.4 || ^8.0
- contao/core-bundle: ^4.13 || ^5.0
- heimrichhannot/contao-utils-bundle: ^2.237 || ^3.3
- symfony/config: >=3.4
- symfony/dependency-injection: >=3.4
Requires (Dev)
- contao/manager-plugin: ^2.0
- contao/test-case: 1.1.*
- friendsofphp/php-cs-fixer: ^2.2
- php-http/guzzle6-adapter: ^1.1
- php-http/message-factory: ^1.0.2
- phpunit/php-token-stream: ^1.4|^2.0|^3.0
- phpunit/phpunit: >=6.0 <6.5
- phpunit/phpunit-mock-objects: ^4.0|^5.0
- satooshi/php-coveralls: ^2.0
- symfony/phpunit-bridge: ^3.2
README
This bundle offers a lost password function for the backend of the Contao CMS.
Features
- 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.
Installation
- 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
Customize
Use Notification center
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
Usage in a custom template
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>
<!-- ... -->
Adjust the email's text
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']
Configuration reference
# 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