| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <form action="/_api/admin/security/passport-google" method="post" class="form-horizontal passportStrategy" id="googleSetting" role="form"
- {% if isRestartingServerNeeded %}style="opacity: 0.4;"{% endif %}>
- <legend class="alert-anchor">{{ t("security_setting.OAuth.Google.name") }}{{ t("security_setting.configuration") }}</legend>
- {% set nameForIsGoogleEnabled = "settingForm[security:passport-google:isEnabled]" %}
- {% set isGoogleEnabled = settingForm['security:passport-google:isEnabled'] %}
- <div class="form-group">
- <label for="{{nameForIsGoogleEnabled}}" class="col-xs-3 control-label">{{ t("security_setting.OAuth.Google.name") }}</label>
- <div class="col-xs-6">
- <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">
- <input name="{{nameForIsGoogleEnabled}}" value="true" type="radio"
- {% if true === isGoogleEnabled %}checked{% endif %}> ON
- </label>
- <label class="btn btn-default btn-rounded btn-outline {% if !isGoogleEnabled %}active{% endif %}" data-active-class="default">
- <input name="{{nameForIsGoogleEnabled}}" value="false" type="radio"
- {% if !isGoogleEnabled %}checked{% endif %}> OFF
- </label>
- </div>
- </div>
- </div>
- <fieldset id="passport-google-hide-when-disabled" {%if !isGoogleEnabled %}style="display: none;"{% endif %}>
- <div class="form-group">
- <label for="settingForm[security:passport-google:clientId]" class="col-xs-3 control-label">{{ t("security_setting.clientID") }}</label>
- <div class="col-xs-6">
- <input class="form-control" type="text" name="settingForm[security:passport-google:clientId]" value="{{ settingForm['security:passport-google:clientId'] || '' }}">
- <p class="help-block">
- <small>
- {{ t("security_setting.Use env var if empty", "OAUTH_GOOGLE_CLIENT_ID") }}
- </small>
- </p>
- </div>
- </div>
- <div class="form-group">
- <label for="settingForm[security:passport-google:clientSecret]" class="col-xs-3 control-label">{{ t("security_setting.client_secret") }}</label>
- <div class="col-xs-6">
- <input class="form-control" type="text" name="settingForm[security:passport-google:clientSecret]" value="{{ settingForm['security:passport-google:clientSecret'] || '' }}">
- <p class="help-block">
- <small>
- {{ t("security_setting.Use env var if empty", "OAUTH_GOOGLE_CLIENT_SECRET") }}
- </small>
- </p>
- </div>
- </div>
- <div class="form-group">
- <label for="settingForm[security:passport-google:callbackUrl]" class="col-xs-3 control-label">{{ t("security_setting.callback_URL") }}</label>
- <div class="col-xs-6">
- <input class="form-control" type="text" name="settingForm[security:passport-google:callbackUrl]" value="{{ settingForm['security:passport-google:callbackUrl'] || '' }}"
- placeholder="http(s)://${growi.host}/passport/google/callback">
- <p class="help-block">
- Input <code>http(s)://${growi.host}/passport/google/callback</code><br>
- <small>
- {{ t("security_setting.Use env var if empty", "OAUTH_GOOGLE_CALLBACK_URI") }}
- </small>
- </p>
- </div>
- </div>
- <div class="form-group">
- <div class="col-xs-6 col-xs-offset-3">
- <div class="checkbox checkbox-info">
- <input type="checkbox" id="bindByUserName-Google" name="settingForm[security:passport-google:isSameUsernameTreatedAsIdenticalUser]" value="1"
- {% if settingForm['security:passport-google:isSameUsernameTreatedAsIdenticalUser'] %}checked{% endif %} />
- <label for="bindByUserName-Google">
- {{ t("security_setting.Treat username matching as identical", "username") }}
- </label>
- <p class="help-block">
- <small>
- {{ t("security_setting.Treat username matching as identical_warn", "username") }}
- </small>
- </p>
- </div>
- </div>
- </div>
- </fieldset>
- <div class="form-group" id="btn-update">
- <div class="col-xs-offset-3 col-xs-6">
- <input type="hidden" name="_csrf" value="{{ csrf() }}">
- <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
- </div>
- </div>
- </form>
- {# Help Section #}
- <hr>
- <h4>
- <i class="fa fa-question-circle" aria-hidden="true"></i>
- <a href="#collapseHelpForGoogleOauth" data-toggle="collapse">How to configure Google OAuth?</a>
- </h4>
- <ol id="collapseHelpForGoogleOauth" class="collapse">
- <li>{{ t("security_setting.OAuth.Google.register_1", "https://console.cloud.google.com/apis/credentials", "Google Cloud Platform API Manager") }}</li>
- <li>{{ t("security_setting.OAuth.Google.register_2") }}</li>
- <li>{{ t("security_setting.OAuth.Google.register_3") }}</li>
- <li>{{ t("security_setting.OAuth.Google.register_4", "https://${growi.host}/passport/google/callback", "${growi.host}") }}</li>
- <li>{{ t("security_setting.OAuth.Google.register_5") }}</li>
- </ol>
- <script>
- $('input[name="settingForm[security:passport-google:isEnabled]"]').change(function() {
- const isEnabled = ($(this).val() === "true");
- if (isEnabled) {
- $('#passport-google-hide-when-disabled').show(400);
- }
- else {
- $('#passport-google-hide-when-disabled').hide(400);
- }
- });
- </script>
|