Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions app/views/hooks/redmine_env_auth/_login_buttons.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<%
settings = Setting.plugin_redmine_env_auth
auth_buttons = []
(1..5).each do |i|
url = settings["auth_url_#{i}"]
label = settings["auth_button_#{i}"]
if url.present? && label.present?
auth_buttons << { url: url, label: label }
end
end
allow_local_login = settings["allow_local_login"] != "false"
%>

<% if auth_buttons.any? %>
<div id="env-auth-buttons" style="margin-top: 20px; text-align: center;">
<hr style="margin: 20px 0;"/>

<div style="display: flex; flex-direction: column; gap: 10px; align-items: center;">
<% auth_buttons.each do |btn| %>
<%= link_to btn[:label], btn[:url], :class => "button env-auth-button", :style => "display: inline-block; padding: 10px 20px; min-width: 200px; text-align: center; background-color: #628db6; color: white; text-decoration: none; border-radius: 4px;" %>
<% end %>
<% if allow_local_login %>
<p style="margin-bottom: 15px; color: #666;">
<%= l(:label_or_login_with) %>
<a href="#" onclick="document.getElementById('login-form').style.display='block'; document.getElementById('env-auth-buttons').style.display='none'; return false;" class="button" style="font-size: 0.9em;">
<%= l(:label_local_account) %>
</a>
</p>
<% end %>
</div>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
var loginForm = document.getElementById('login-form');
var authButtons = document.getElementById('env-auth-buttons');

if (loginForm && authButtons) {
// Masquer le formulaire de login par défaut et afficher les boutons
loginForm.style.display = 'none';
}
});
</script>
<% end %>
22 changes: 22 additions & 0 deletions app/views/settings/_redmine_env_auth_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,25 @@
<%= text_field_tag "settings[external_logout_target]", @settings["external_logout_target"] %><br/>
<%= l(:label_external_logout_target_description)%><br/>
</p>

<fieldset>
<legend><%= l(:label_external_auth_buttons) %></legend>
<p><%= l(:label_external_auth_buttons_description) %></p>

<p>
<%= hidden_field_tag "settings[allow_local_login]", "false" %>
<%= check_box_tag "settings[allow_local_login]", "true", @settings["allow_local_login"] != "false" %>
<%= content_tag(:label, l(:label_allow_local_login)) %><br/>
<small><%= l(:label_allow_local_login_description) %></small>
</p>

<% (1..5).each do |i| %>
<div style="margin-bottom: 10px; padding: 5px; border: 1px solid #ddd; border-radius: 4px;">
<strong><%= l(:label_auth_button_pair, :num => i) %></strong><br/>
<%= content_tag(:label, l(:label_auth_url)) %>
<%= text_field_tag "settings[auth_url_#{i}]", @settings["auth_url_#{i}"], :size => 50, :placeholder => "https://example.com/shibboleth/login" %><br/>
<%= content_tag(:label, l(:label_auth_button_label)) %>
<%= text_field_tag "settings[auth_button_#{i}]", @settings["auth_button_#{i}"], :size => 30, :placeholder => l(:label_auth_button_placeholder) %><br/>
</div>
<% end %>
</fieldset>
12 changes: 11 additions & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ de:
label_env_variable_new_user_initial_locked: Sperre neu registrierte Konten
label_show_logout_link: Abmelden-Link anzeigen
label_external_logout_target: Ziel für Abmelden-Link
label_external_logout_target_description: hier kann ein externer Abmeldeservice angegeben werden. Wenn leer, Umleitung auf internen logout-Pfad
label_external_logout_target_description: hier kann ein externer Abmeldeservice angegeben werden. Wenn leer, Umleitung auf internen logout-Pfad
label_external_auth_buttons: Externe Authentifizierungsschaltflächen
label_external_auth_buttons_description: Konfigurieren Sie externe Authentifizierungs-URLs und die entsprechenden Schaltflächenbeschriftungen. Leer lassen zum Deaktivieren.
label_auth_button_pair: Schaltfläche %{num}
label_auth_url: Authentifizierungs-URL
label_auth_button_label: Schaltflächenbeschriftung
label_auth_button_placeholder: z.B. Shibboleth-Anmeldung
label_or_login_with: "Oder anmelden mit einem "
label_local_account: lokalen Konto
label_allow_local_login: Lokale Anmeldung erlauben
label_allow_local_login_description: "Wenn deaktiviert, wird der Link 'lokales Konto' auf der Anmeldeseite nicht angezeigt"
12 changes: 11 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ en:
label_env_variable_new_user_initial_locked: lock newly registered accounts
label_show_logout_link: display logout link
label_external_logout_target: where to redirect on logout
label_external_logout_target_description: specify an external logout service. if empty the internal logout path is used
label_external_logout_target_description: specify an external logout service. if empty the internal logout path is used
label_external_auth_buttons: External Authentication Buttons
label_external_auth_buttons_description: Configure external authentication URLs and their corresponding button labels. Leave empty to disable.
label_auth_button_pair: Button %{num}
label_auth_url: Authentication URL
label_auth_button_label: Button label
label_auth_button_placeholder: e.g. Shibboleth Login
label_or_login_with: "Or login with a "
label_local_account: local account
label_allow_local_login: Allow local login
label_allow_local_login_description: "If unchecked, the 'local account' link will not be displayed on the login page"
35 changes: 35 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
fr:
label_allow_other_login_admins: tous les administrateurs
label_allow_other_login_all: tous les utilisateurs
label_allow_other_login: autoriser la connexion standard
label_allow_other_login_none: désactivé
label_allow_other_login_users: certains utilisateurs (séparés par des virgules)
label_default: par défaut
label_email_address: adresse email
label_enabled: activer
label_env_variable_name: nom de la variable d'environnement de requête
label_ldap_checked_auto_registration: inscription automatique avec vérification LDAP
label_login_name: identifiant
label_remove_suffix_help: le texte indiqué sera supprimé de la fin de la valeur de la variable d'environnement
label_remove_suffix: supprimer le suffixe
label_redmine_user_property: propriété utilisateur Redmine
label_env_checked_auto_registration: inscription automatique avec variables d'environnement
label_env_variable_firstname: variable avec le prénom
label_env_variable_lastname: variable avec le nom
label_env_variable_email: variable avec l'email
label_env_variable_admins: liste des identifiants administrateurs
label_env_variable_admins_description: liste des identifiants séparés par des virgules qui seront inscrits comme administrateurs
label_env_variable_new_user_initial_locked: verrouiller les comptes nouvellement inscrits
label_show_logout_link: afficher le lien de déconnexion
label_external_logout_target: où rediriger lors de la déconnexion
label_external_logout_target_description: spécifiez un service de déconnexion externe. Si vide, le chemin de déconnexion interne est utilisé
label_external_auth_buttons: Boutons d'authentification externe
label_external_auth_buttons_description: Configurez les URLs d'authentification externe et les libellés des boutons correspondants. Laissez vide pour désactiver.
label_auth_button_pair: Bouton %{num}
label_auth_url: URL d'authentification
label_auth_button_label: Libellé du bouton
label_auth_button_placeholder: ex. Connexion Shibboleth
label_or_login_with: "Ou se connecter avec un "
label_local_account: compte local
label_allow_local_login: Autoriser la connexion locale
label_allow_local_login_description: "Si décoché, le lien 'compte local' ne sera pas affiché sur la page de connexion"
35 changes: 35 additions & 0 deletions config/locales/hu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
hu:
label_allow_other_login_admins: minden adminisztrátor
label_allow_other_login_all: minden felhasználó
label_allow_other_login: normál bejelentkezés engedélyezése
label_allow_other_login_none: letiltva
label_allow_other_login_users: egyes felhasználók (vesszővel elválasztva)
label_default: alapértelmezett
label_email_address: e-mail cím
label_enabled: engedélyezés
label_env_variable_name: kérés környezeti változó neve
label_ldap_checked_auto_registration: automatikus regisztráció LDAP ellenőrzéssel
label_login_name: bejelentkezési név
label_remove_suffix_help: a megadott szöveg eltávolításra kerül a környezeti változó szövegének végéről
label_remove_suffix: utótag eltávolítása
label_redmine_user_property: Redmine felhasználói tulajdonság
label_env_checked_auto_registration: automatikus regisztráció környezeti változókkal
label_env_variable_firstname: keresztnév változója
label_env_variable_lastname: vezetéknév változója
label_env_variable_email: e-mail változója
label_env_variable_admins: adminisztrátor bejelentkezések listája
label_env_variable_admins_description: vesszővel elválasztott bejelentkezések listája, amelyek adminisztrátorként lesznek regisztrálva
label_env_variable_new_user_initial_locked: újonnan regisztrált fiókok zárolása
label_show_logout_link: kijelentkezési link megjelenítése
label_external_logout_target: hová irányítson kijelentkezéskor
label_external_logout_target_description: adjon meg egy külső kijelentkezési szolgáltatást. Ha üres, a belső kijelentkezési útvonal kerül felhasználásra
label_external_auth_buttons: Külső hitelesítési gombok
label_external_auth_buttons_description: Konfigurálja a külső hitelesítési URL-eket és a hozzájuk tartozó gombcímkéket. Hagyja üresen a letiltáshoz.
label_auth_button_pair: Gomb %{num}
label_auth_url: Hitelesítési URL
label_auth_button_label: Gomb címke
label_auth_button_placeholder: pl. Shibboleth bejelentkezés
label_or_login_with: "Vagy jelentkezzen be "
label_local_account: helyi fiókkal
label_allow_local_login: Helyi bejelentkezés engedélyezése
label_allow_local_login_description: "Ha nincs bejelölve, a 'helyi fiók' link nem jelenik meg a bejelentkezési oldalon"
12 changes: 11 additions & 1 deletion config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@ ja:
label_env_variable_new_user_initial_locked: 新規登録アカウントをロック
label_show_logout_link: ログアウトリンクを表示
label_external_logout_target: ログアウト時のリダイレクト先
label_external_logout_target_description: 外部ログアウトサービスを指定します。空の場合、内部のログアウトパスが使用されます。
label_external_logout_target_description: 外部ログアウトサービスを指定します。空の場合、内部のログアウトパスが使用されます。
label_external_auth_buttons: 外部認証ボタン
label_external_auth_buttons_description: 外部認証URLとそれに対応するボタンラベルを設定します。無効にするには空のままにしてください。
label_auth_button_pair: ボタン %{num}
label_auth_url: 認証URL
label_auth_button_label: ボタンラベル
label_auth_button_placeholder: "例: Shibbolethログイン"
label_or_login_with: "または"
label_local_account: ローカルアカウントでログイン
label_allow_local_login: ローカルログインを許可
label_allow_local_login_description: "チェックを外すと、ログインページに'ローカルアカウント'リンクが表示されません"
35 changes: 35 additions & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
pt-BR:
label_allow_other_login_admins: todos os administradores
label_allow_other_login_all: todos os usuários
label_allow_other_login: permitir login padrão
label_allow_other_login_none: desabilitado
label_allow_other_login_users: alguns usuários (separados por vírgula)
label_default: padrão
label_email_address: endereço de e-mail
label_enabled: habilitar
label_env_variable_name: nome da variável de ambiente de requisição
label_ldap_checked_auto_registration: registro automático com verificação LDAP
label_login_name: nome de login
label_remove_suffix_help: o texto informado será removido do final do texto na variável de ambiente
label_remove_suffix: remover sufixo
label_redmine_user_property: propriedade de usuário do Redmine
label_env_checked_auto_registration: registro automático com variáveis de ambiente
label_env_variable_firstname: variável com primeiro nome
label_env_variable_lastname: variável com sobrenome
label_env_variable_email: variável com e-mail
label_env_variable_admins: lista de logins de administradores
label_env_variable_admins_description: lista separada por vírgulas de logins que serão registrados como administradores
label_env_variable_new_user_initial_locked: bloquear contas recém-registradas
label_show_logout_link: exibir link de logout
label_external_logout_target: para onde redirecionar no logout
label_external_logout_target_description: especifique um serviço de logout externo. Se vazio, o caminho de logout interno é usado
label_external_auth_buttons: Botões de autenticação externa
label_external_auth_buttons_description: Configure URLs de autenticação externa e seus rótulos de botão correspondentes. Deixe vazio para desabilitar.
label_auth_button_pair: Botão %{num}
label_auth_url: URL de autenticação
label_auth_button_label: Rótulo do botão
label_auth_button_placeholder: ex. Login Shibboleth
label_or_login_with: "Ou faça login com uma "
label_local_account: conta local
label_allow_local_login: Permitir login local
label_allow_local_login_description: "Se desmarcado, o link 'conta local' não será exibido na página de login"
35 changes: 35 additions & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ru:
label_allow_other_login_admins: все администраторы
label_allow_other_login_all: все пользователи
label_allow_other_login: разрешить стандартный вход
label_allow_other_login_none: отключено
label_allow_other_login_users: некоторые пользователи (через запятую)
label_default: по умолчанию
label_email_address: адрес электронной почты
label_enabled: включить
label_env_variable_name: имя переменной окружения запроса
label_ldap_checked_auto_registration: автоматическая регистрация с проверкой LDAP
label_login_name: имя пользователя
label_remove_suffix_help: указанный текст будет удален с конца текста в переменной окружения
label_remove_suffix: удалить суффикс
label_redmine_user_property: свойство пользователя Redmine
label_env_checked_auto_registration: автоматическая регистрация с переменными окружения
label_env_variable_firstname: переменная с именем
label_env_variable_lastname: переменная с фамилией
label_env_variable_email: переменная с email
label_env_variable_admins: список логинов администраторов
label_env_variable_admins_description: список логинов через запятую, которые будут зарегистрированы как администраторы
label_env_variable_new_user_initial_locked: блокировать новые зарегистрированные аккаунты
label_show_logout_link: показывать ссылку выхода
label_external_logout_target: куда перенаправлять при выходе
label_external_logout_target_description: укажите внешний сервис выхода. Если пусто, используется внутренний путь выхода
label_external_auth_buttons: Кнопки внешней аутентификации
label_external_auth_buttons_description: Настройте URL-адреса внешней аутентификации и соответствующие надписи на кнопках. Оставьте пустым для отключения.
label_auth_button_pair: Кнопка %{num}
label_auth_url: URL аутентификации
label_auth_button_label: Надпись на кнопке
label_auth_button_placeholder: напр. Вход Shibboleth
label_or_login_with: "Или войти с "
label_local_account: локальным аккаунтом
label_allow_local_login: Разрешить локальный вход
label_allow_local_login_description: "Если снято, ссылка 'локальный аккаунт' не будет отображаться на странице входа"
12 changes: 11 additions & 1 deletion config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ zh:
label_env_variable_new_user_initial_locked: 锁定新注册的账户
label_show_logout_link: 显示登出链接
label_external_logout_target: 登出时重定向的位置
label_external_logout_target_description: 指定一个外部登出服务。如果为空,将使用内部登出路径
label_external_logout_target_description: 指定一个外部登出服务。如果为空,将使用内部登出路径
label_external_auth_buttons: 外部认证按钮
label_external_auth_buttons_description: 配置外部认证URL及其对应的按钮标签。留空以禁用。
label_auth_button_pair: 按钮 %{num}
label_auth_url: 认证URL
label_auth_button_label: 按钮标签
label_auth_button_placeholder: 例如 Shibboleth登录
label_or_login_with: "或使用"
label_local_account: 本地账户登录
label_allow_local_login: 允许本地登录
label_allow_local_login_description: "如果取消勾选,登录页面将不显示'本地账户'链接"
17 changes: 15 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
author "Intera GmbH"
url "http://github.com/intera/redmine_env_auth" if respond_to?(:url)
description "A plugin for authentication based on variables in the request environment."
version "1.3"
version "1.4"

Redmine::MenuManager.map :account_menu do |menu|
# hide the logout link if an automatic login is active
Expand Down Expand Up @@ -37,14 +37,27 @@
"env_variable_admins" => "",
"env_variable_new_user_initial_locked" => "false",
"show_logout_link" => "false",
"external_logout_target" => ""
"external_logout_target" => "",
"auth_url_1" => "",
"auth_button_1" => "",
"auth_url_2" => "",
"auth_button_2" => "",
"auth_url_3" => "",
"auth_button_3" => "",
"auth_url_4" => "",
"auth_button_4" => "",
"auth_url_5" => "",
"auth_button_5" => "",
"allow_local_login" => "true"
}
end

if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
RedmineEnvAuth::EnvAuthPatch.install
require_relative 'lib/redmine_env_auth/hooks'
else
Rails.configuration.to_prepare do
RedmineEnvAuth::EnvAuthPatch.install
end
require_relative 'lib/redmine_env_auth/hooks'
end
Loading