Add a banner informing about token expiration
What does this MR do and why?
Add a banner informing about token expiration
Display a banner to all users, similar to broadcast banners, for GitLab version between 16.0 and 17.0, both included.
The banner informs about upcoming expiration of tokens and how to troubleshoot the expiration.
The banner is dismissabled. The data is persisted in the browser cookie and expires in one year from the date it has been dismissed. Like other broadcast banners, if the user opens an incognito window the banner reappears.
On a follow-up we are adding persistency beyond the cookie storage: Persist notification dismissal server-side with... (!154984 - closed)
Changelog: changed
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
- To display the banner, change the upper limit GitLab version:
diff --git a/app/views/shared/_token_expiration_banner.html.haml b/app/views/shared/_token_expiration_banner.html.haml
index 408166326734..9defe33f8935 100644
--- a/app/views/shared/_token_expiration_banner.html.haml
+++ b/app/views/shared/_token_expiration_banner.html.haml
@@ -1,7 +1,7 @@
- id = 'token_expiration'
- cookie_key = 'hide_token_expiration_banner'
-- return unless Gitlab.version_info >= Gitlab::VersionInfo.new(16, 0) && Gitlab.version_info <= Gitlab::VersionInfo.new(17, 0)
+- return unless Gitlab.version_info >= Gitlab::VersionInfo.new(16, 0) && Gitlab.version_info <= Gitlab::VersionInfo.new(17, 1)
- return unless cookies[cookie_key].blank?
.gl-broadcast-message.broadcast-banner-message.banner{ role: "alert", class: "js-broadcast-notification-#{id} light-indigo" }
- Sign in