Browse Source

en/ja and brush up forms

sou 7 years ago
parent
commit
5eb5879b21

+ 3 - 1
lib/locales/en-US/translation.json

@@ -365,7 +365,9 @@
       "group_search_user_DN_property_detail": "The property of user object to use in <code>&#123;&#123;dn&#125;&#125;</code> interpolation of <code>Group Search Filter</code>.",
       "group_search_user_DN_property_detail": "The property of user object to use in <code>&#123;&#123;dn&#125;&#125;</code> interpolation of <code>Group Search Filter</code>.",
       "test_config": "Test Saved Configuration"
       "test_config": "Test Saved Configuration"
     },
     },
-    "Google OAuth": {
+    "Google_OAuth": {
+      "use_Google_OAuth": "Use Google OAuth",
+      "change_redirect_url": "Enter <code>https://${crowi.host}/passport/google/callback</code> <br>(where <code>${crowi.host}</code> is your host name) for \"Authorized redirect URIs\"."
     },
     },
     "Facebook": {
     "Facebook": {
     },
     },

+ 4 - 2
lib/locales/ja/translation.json

@@ -379,9 +379,11 @@
       "group_search_filter_detail2": "ログイン対象ユーザーオブジェクトのプロパティーで置換する場合は <code>&#123;&#123;dn&#125;&#125;</code> を用いてください。",
       "group_search_filter_detail2": "ログイン対象ユーザーオブジェクトのプロパティーで置換する場合は <code>&#123;&#123;dn&#125;&#125;</code> を用いてください。",
       "group_search_filter_detail3": "<code>(&(cn=group1)(memberUid=&#123;&#123;dn&#125;&#125;))</code> は <code>cn=group1</code> と、ユーザーの <code>uid</code> を含む <code>memberUid</code> を持つグループにヒットします(<code>ユーザーの DN プロパティー</code> がデフォルトから変更されていない場合)",
       "group_search_filter_detail3": "<code>(&(cn=group1)(memberUid=&#123;&#123;dn&#125;&#125;))</code> は <code>cn=group1</code> と、ユーザーの <code>uid</code> を含む <code>memberUid</code> を持つグループにヒットします(<code>ユーザーの DN プロパティー</code> がデフォルトから変更されていない場合)",
       "group_search_user_DN_property": "ユーザーの DN プロパティー",
       "group_search_user_DN_property": "ユーザーの DN プロパティー",
-      "group_search_user_DN_property_detail": "<code>グループ検索フィルター</code> 内の <code>&#123;&#123;dn&#125;&#125;</code> で置換される、ユーザーオブジェクトのプロパティー"
+      "group_search_user_DN_property_detail": "<code>グループ検索フィルター</code> 内の <code>&#123;&#123;dn&#125;&#125;</code> で置換される、ユーザーオブジェクトのプロパティー",
+      "test_config": "ログインテスト"
     },
     },
-    "Google OAuth": {
+    "Google_OAuth": {
+      "change_redirect_url": "承認済みのリダイレクトURLに、 <code>https://${crowi.host}/passort/google/callback</code> を入力<br>(<code>${crowi.host}</code>は環境に合わせて変更してください)"
     },
     },
     "Facebook": {
     "Facebook": {
     },
     },

+ 5 - 0
lib/util/swigFunctions.js

@@ -92,6 +92,11 @@ module.exports = function(crowi, app, req, locals) {
     return config.crowi['google:clientId'] && config.crowi['google:clientSecret'];
     return config.crowi['google:clientId'] && config.crowi['google:clientSecret'];
   };
   };
 
 
+  locals.passportGoogleLoginEnabled = function() {
+    var config = crowi.getConfig();
+    return locals.isEnabledPassport() && config.crowi['security:passport-google:isEnabled'];
+  };
+
   locals.searchConfigured = function() {
   locals.searchConfigured = function() {
     if (crowi.getSearcher()) {
     if (crowi.getSearcher()) {
       return true;
       return true;

+ 16 - 37
lib/views/admin/widget/passport/google-oauth.html

@@ -5,7 +5,7 @@
   {% set nameForIsGoogleEnabled = "settingForm[security:passport-google:isEnabled]" %}
   {% set nameForIsGoogleEnabled = "settingForm[security:passport-google:isEnabled]" %}
   {% set isGoogleEnabled = settingForm['security:passport-google:isEnabled'] %}
   {% set isGoogleEnabled = settingForm['security:passport-google:isEnabled'] %}
   <div class="form-group">
   <div class="form-group">
-    <label for="{{nameForIsGoogleEnabled}}" class="col-xs-3 control-label">Use Google OAuth</label>
+    <label for="{{nameForIsGoogleEnabled}}" class="col-xs-3 control-label">{{ t("security_setting.Google_OAuth.use_Google_OAuth") }}</label>
     <div class="col-xs-6">
     <div class="col-xs-6">
       <div class="btn-group btn-toggle" data-toggle="buttons">
       <div class="btn-group btn-toggle" data-toggle="buttons">
         <label class="btn btn-default btn-rounded btn-outline {% if isGoogleEnabled %}active{% endif %}" data-active-class="primary">
         <label class="btn btn-default btn-rounded btn-outline {% if isGoogleEnabled %}active{% endif %}" data-active-class="primary">
@@ -20,16 +20,21 @@
     </div>
     </div>
   </div>
   </div>
   <fieldset id="passport-google-hide-when-disabled" {%if !isGoogleEnabled %}style="display: none;"{% endif %}>
   <fieldset id="passport-google-hide-when-disabled" {%if !isGoogleEnabled %}style="display: none;"{% endif %}>
-    <h4>{{ t("security_setting.google_setting") }}</h4>
-    <ol class="help-block">
-      <li>{{ t("security_setting.access_api_manager") }}</li>
-      <li>{{ t("security_setting.create_project") }}</li>
-      <li>{{ t("security_setting.create_auth_to_oauth") }}</li>
-      <ol>
-        <li>{{ t("security_setting.select_webapp") }}</li>
-        <li>{{ t("security_setting.change_redirect_url") }}</li>
-      </ol>
-    </ol>
+
+    <div class="form-group">
+      <label for="settingForm[security:passport-google:clientId]" class="col-xs-3 control-label">{{ t("security_setting.google_setting") }}</label>
+      <div class="col-xs-6">
+        <ol class="help-block">
+          <li>{{ t("security_setting.access_api_manager") }}</li>
+          <li>{{ t("security_setting.create_project") }}</li>
+          <li>{{ t("security_setting.create_auth_to_oauth") }}</li>
+          <ol>
+            <li>{{ t("security_setting.select_webapp") }}</li>
+            <li>{{ t("security_setting.Google_OAuth.change_redirect_url") }}</li>
+          </ol>
+        </ol>
+      </div>
+    </div>
 
 
     <div class="form-group">
     <div class="form-group">
       <label for="settingForm[security:passport-google:clientId]" class="col-xs-3 control-label">{{ t("security_setting.clientID") }}</label>
       <label for="settingForm[security:passport-google:clientId]" class="col-xs-3 control-label">{{ t("security_setting.clientID") }}</label>
@@ -67,13 +72,6 @@
     <div class="col-xs-offset-3 col-xs-6">
     <div class="col-xs-offset-3 col-xs-6">
       <input type="hidden" name="_csrf" value="{{ csrf() }}">
       <input type="hidden" name="_csrf" value="{{ csrf() }}">
       <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
       <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
-      <button type="button"
-            class="btn btn-default passport-google-hide-when-disabled"
-            data-target="#test-google-account" data-toggle="modal"
-            {%if !isGoogleEnabled %}style="display: none;"{% endif %}>
-
-          {{ t("security_setting.ldap.test_config") }}
-        </button>
     </div>
     </div>
   </div>
   </div>
 
 
@@ -154,25 +152,6 @@
 </ol>
 </ol>
 {% endif %}
 {% endif %}
 
 
-<div class="modal test-google-account" id="test-google-account">
-  <div class="modal-dialog">
-    <div class="modal-content">
-
-      <div class="modal-header">
-        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-        <div class="modal-title">Test Google Account</div>
-      </div>
-
-      <div class="modal-body">
-
-        {% include '../../../widget/passport/ldap-association-tester.html' with { showLog: true } %}
-
-      </div><!-- /.modal-body -->
-
-    </div><!-- /.modal-content -->
-  </div><!-- /.modal-dialog -->
-</div><!-- /.modal -->
-
 <script>
 <script>
   $('input[name="settingForm[security:passport-google:isEnabled]"]').change(function() {
   $('input[name="settingForm[security:passport-google:isEnabled]"]').change(function() {
       const isEnabled = ($(this).val() === "true");
       const isEnabled = ($(this).val() === "true");

+ 13 - 11
lib/views/login.html

@@ -42,12 +42,12 @@
         # The case that there already exists a user whose username matches ID of the newly created LDAP user
         # The case that there already exists a user whose username matches ID of the newly created LDAP user
         # https://github.com/weseek/growi/issues/193
         # https://github.com/weseek/growi/issues/193
         #}
         #}
-        {% set failedProvider = req.flash('provider-DuplicatedUsernameException') %}
-        {% if failedProvider != null %}
+        {% set isDuplicatedUsernameExceptionOccured = req.flash('isDuplicatedUsernameExceptionOccured') %}
+        {% if isDuplicatedUsernameExceptionOccured != null %}
         <div class="alert alert-warning small">
         <div class="alert alert-warning small">
           <p><strong><i class="icon-fw icon-ban"></i>DuplicatedUsernameException occured</strong></p>
           <p><strong><i class="icon-fw icon-ban"></i>DuplicatedUsernameException occured</strong></p>
           <p>
           <p>
-            Your {{ failedProvider }} authentication was succeess, but a new user could not be created.
+            Your LDAP authentication was succeess, but a new user could not be created.
             See the issue <a href="https://github.com/weseek/growi/issues/193">#193</a>.
             See the issue <a href="https://github.com/weseek/growi/issues/193">#193</a>.
           </p>
           </p>
         </div>
         </div>
@@ -145,9 +145,10 @@
         </div>
         </div>
         {% endif %}
         {% endif %}
 
 
+        {% if passportGoogleLoginEnabled() || passportGithubLoginEnabled() || passportFacebookLoginEnabled() || passportTwitterLoginEnabled() %}
         <hr>
         <hr>
         <div class="input-group m-t-15 m-b-10 mx-auto d-flex flex-row justify-content-around flex-wrap">
         <div class="input-group m-t-15 m-b-10 mx-auto d-flex flex-row justify-content-around flex-wrap">
-          {#% if passportGoogleLoginEnabled() %#}
+          {% if passportGoogleLoginEnabled() %}
           <form role="form" action="/passport/google" method="get">
           <form role="form" action="/passport/google" method="get">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-google">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-google">
               <span class="btn-label"><i class="icon-social-google"></i></span>
               <span class="btn-label"><i class="icon-social-google"></i></span>
@@ -155,8 +156,8 @@
             </button>
             </button>
             <div class="small text-right">by Google Account</div>
             <div class="small text-right">by Google Account</div>
           </form>
           </form>
-          {#% endif %#}
-          {#% if passportGithubLoginEnabled() %#}
+          {% endif %}
+          {% if passportGithubLoginEnabled() %}
           <form role="form" action="/auth/passport/github" method="get">
           <form role="form" action="/auth/passport/github" method="get">
             <input type="hidden" name="_csrf" value="{{ csrf() }}">
             <input type="hidden" name="_csrf" value="{{ csrf() }}">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-github">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-github">
@@ -165,8 +166,8 @@
             </button>
             </button>
             <div class="small text-right">by Github Account</div>
             <div class="small text-right">by Github Account</div>
           </form>
           </form>
-          {#% endif %#}
-          {#% if passportFacebookLoginEnabled() %#}
+          {% endif %}
+          {% if passportFacebookLoginEnabled() %}
           <form role="form" action="/auth/passport/facebook" method="get">
           <form role="form" action="/auth/passport/facebook" method="get">
             <input type="hidden" name="_csrf" value="{{ csrf() }}">
             <input type="hidden" name="_csrf" value="{{ csrf() }}">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-facebook">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-facebook">
@@ -175,8 +176,8 @@
             </button>
             </button>
             <div class="small text-right">by Facebook Account</div>
             <div class="small text-right">by Facebook Account</div>
           </form>
           </form>
-          {#% endif %#}
-          {#% if passportTwitterLoginEnabled() %#}
+          {% endif %}
+          {% if passportTwitterLoginEnabled() %}
           <form role="form" action="/auth/passport/twitter" method="get">
           <form role="form" action="/auth/passport/twitter" method="get">
             <input type="hidden" name="_csrf" value="{{ csrf() }}">
             <input type="hidden" name="_csrf" value="{{ csrf() }}">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-twitter">
             <button type="submit" class="fcbtn btn btn-danger btn-1b btn-login-twitter">
@@ -185,8 +186,9 @@
             </button>
             </button>
             <div class="small text-right">by Twitter Account</div>
             <div class="small text-right">by Twitter Account</div>
           </form>
           </form>
-          {#% endif %#}
+          {% endif %}
         </div>
         </div>
+        {% endif %}
 
 
         <hr>
         <hr>