Skip to content

Sign In: Show link to Terms of Use only if terms exist

Jonas Wälter requested to merge siemens/gitlab:sign_in/terms-if-exist into master

What does this MR do and why?

On the Sign in page, there's a hard-coded link to the Terms of Use page (/-/users/terms). But if no terms exist, the user is redirected back to the Sign in page. In that case, the link is useless (see also #372425 (comment 1113600607)). So let's show the link only if terms exist.

🛠 with at Siemens

/cc @bufferoverflow

Screenshots or screen recordings

Before MR (if no terms exist):

Terms_of_Use_before

After MR:

If terms exist If terms don't exist
image image

How to set up and validate locally

  1. Visit Sign In page: http://localhost:3000/users/sign_in
  2. Verify that no link is shown
  3. Sign in as administrator and add Terms of Use in the Admin area: http://localhost:3000/admin/application_settings/general#js-terms-settings
  4. Sign out
  5. Verify that the link is shown

Note: Once you added Terms of Use, you can't remove it again over UI, but using Rails:

ApplicationSetting::Term.destroy_all

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports