List token names that have expired in email
What does this MR do and why?
This MR aims to include the expired personal access token names in the email that's sent to the user to make it easier for the user to act upon.
Resolves Include name of expiring access token(s) in ema... (#375275 - closed)
Screenshots or screen recordings
Screenshots taken from LetterOpenerWeb at http://127.0.0.1:3001/rails/letter_opener/ (normally it runs on port 3000, but I have multiple GDK's running, so it's 3001 for me):
token_names
is empty
Where HTML
Text
token_names
isn't empty
Where HTML
Text
How to set up and validate locally
- In your local GitLab instance, create a new PAT via
http://127.0.0.1:3000/-/profile/personal_access_tokens
for theroot
user calledexpired
. It doesn't matter what scopes or expiration date you set. - Bring up a rails console, e.g.
gdk rails c
. - Run the following to force the expiration of the PAT and send the email:
user = User.find_by_username('root') user.personal_access_tokens.where(name: 'expired').first.update!(expires_at: Date.today) PersonalAccessTokens::ExpiredNotificationWorker.new.perform
- Visit http://127.0.0.1:3000/rails/letter_opener/ to confirm you see the correct emails.
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.
Related to #375275 (closed)
Edited by Ash McKenzie