diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /app/helpers/projects_helper.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r-- | app/helpers/projects_helper.rb | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index e3b63d122d2..8366b25d2bc 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -196,12 +196,26 @@ module ProjectsHelper cookies["hide_auto_devops_implicitly_enabled_banner_#{project.id}".to_sym].blank? end - def link_to_set_password - if current_user.require_password_creation_for_git? - link_to s_('SetPasswordToCloneLink|set a password'), edit_profile_password_path - else - link_to s_('CreateTokenToCloneLink|create a personal access token'), profile_personal_access_tokens_path - end + def no_password_message + push_pull_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('gitlab-basics/start-using-git', anchor: 'pull-and-push') } + clone_with_https_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('gitlab-basics/start-using-git', anchor: 'clone-with-https') } + set_password_link_start = '<a href="%{url}">'.html_safe % { url: edit_profile_password_path } + set_up_pat_link_start = '<a href="%{url}">'.html_safe % { url: profile_personal_access_tokens_path } + + message = if current_user.require_password_creation_for_git? + _('Your account is authenticated with SSO or SAML. To %{push_pull_link_start}push and pull%{link_end} over %{protocol} with Git using this account, you must %{set_password_link_start}set a password%{link_end} or %{set_up_pat_link_start}set up a Personal Access Token%{link_end} to use instead of a password. For more information, see %{clone_with_https_link_start}Clone with HTTPS%{link_end}.') + else + _('Your account is authenticated with SSO or SAML. To %{push_pull_link_start}push and pull%{link_end} over %{protocol} with Git using this account, you must %{set_up_pat_link_start}set up a Personal Access Token%{link_end} to use instead of a password. For more information, see %{clone_with_https_link_start}Clone with HTTPS%{link_end}.') + end + + html_escape(message) % { + push_pull_link_start: push_pull_link_start, + protocol: gitlab_config.protocol.upcase, + clone_with_https_link_start: clone_with_https_link_start, + set_password_link_start: set_password_link_start, + set_up_pat_link_start: set_up_pat_link_start, + link_end: '</a>'.html_safe + } end # Returns true if any projects are present. @@ -382,6 +396,15 @@ module ProjectsHelper "" end + # Returns the confirm phrase the user needs to type in order to delete the project + # + # Thus the phrase should include the namespace to make it very clear to the + # user which project is subject to deletion. + # Relevant issue: https://gitlab.com/gitlab-org/gitlab/-/issues/343591 + def delete_confirm_phrase(project) + project.path_with_namespace + end + private def tab_ability_map @@ -590,6 +613,7 @@ module ProjectsHelper %w[ environments clusters + cluster_agents functions error_tracking alert_management |