소스 검색

[Web] Disable SSO button when admin login is disabled, fixes #4297

andryyy 3 년 전
부모
커밋
f01de1a5c0
2개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 0
      data/web/inc/header.inc.php
  2. 9 3
      data/web/templates/user/tab-user-auth.twig

+ 1 - 0
data/web/inc/header.inc.php

@@ -44,6 +44,7 @@ $globalVariables = [
   'available_languages' => $AVAILABLE_LANGUAGES,
   'lang' => $lang,
   'skip_sogo' => (getenv('SKIP_SOGO') == 'y'),
+  'allow_admin_email_login' => (getenv('ALLOW_ADMIN_EMAIL_LOGIN') == 'n'),
   'mailcow_apps' => $MAILCOW_APPS,
   'app_links' => customize('get', 'app_links'),
   'is_root_uri' => (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) == '/'),

+ 9 - 3
data/web/templates/user/tab-user-auth.twig

@@ -6,9 +6,15 @@
       <div class="row">
         <div class="hidden-xs col-md-3 col-xs-5 text-right"></div>
         <div class="col-md-3 col-xs-12">
-          <a target="_blank" href="/sogo-auth.php?login={{ mailcow_cc_username }}" role="button" class="btn btn-default btn-block btn-xs-lg">
-            <i class="bi bi-inbox-fill"></i> {{ lang.user.open_webmail_sso }}
-          </a>
+          {% if dual_login and allow_admin_email_login == 'n' %}
+            <button disabled class="btn btn-default btn-block btn-xs-lg">
+              <i class="bi bi-inbox-fill"></i> {{ lang.user.open_webmail_sso }}
+            </button>
+          {% else %}
+            <a target="_blank" href="#" disabled role="button" class="btn btn-default btn-block btn-xs-lg">
+              <i class="bi bi-inbox-fill"></i> {{ lang.user.open_webmail_sso }}
+            </a>
+          {% endif %}
         </div>
       </div>
       <hr>