Resolve "Send password expiration notice via email"
What does this MR do and why?
Add feature: send email notification to user when password is about to expire.
-
Add Notify.notice_password_expiring_email
email method and template. -
Add PasswordExpiration::SendNotificationEmailService
to check if password is about to expire and send email. -
Add PasswordExpiration::SendNotificationEmailWorker
cron worker. -
Load cron job in JH
directory.
The translation part of this MR has been certified by @shuangzhang .
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
- Enable password expiration feature.
# rails console with STARTER license or above
a = ApplicationSetting.first
a.password_expiration_enabled = true
a.password_expires_notice_before_days = 7
a.password_expires_in_days = 90
a.save
::Feature.enable(:password_expiration)
u = User.first
u.user_detail.password_last_changed_at = 83.days.ago
u.save
- Change the execution time of the cron work.
# jh/config/schedule.yml
# run every minute
expire_password_worker:
cron: "* * * * *"
class: "PasswordExpiration::SendNotificationEmailWorker"
-
gdk restart
and visit {gdk}/rails/letter_opener, you will see: ( If it doesn't show up, please wait a few minutes. )
Preview of related email:
{GDK}/rails/mailers/notify/notice_password_expiring_email
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Closes #1935 (closed)
由 奇廷 陈 编辑于