|
284 | 284 | {{ not isLite ? '<hr>' }} |
285 | 285 |
|
286 | 286 | {% set fields %} |
287 | | - <h1>{{ 'Basic Auth'|t('sherlock') }}</h1> |
288 | | - {{ forms.autosuggestField({ |
289 | | - label: 'Username'|t('sherlock'), |
290 | | - name: (isLite ? '' : 'basicAuthUsername'), |
291 | | - instructions: 'A username to use for basic authentication when accessing the site.'|t('sherlock'), |
292 | | - suggestEnvVars: true, |
293 | | - suggestions: craft.cp.getEnvSuggestions(), |
294 | | - warning: (config.basicAuthUsername is defined ? configWarning('basicAuthUsername')), |
295 | | - value: (isLite ? '' : settings.basicAuthUsername), |
296 | | - errors: settings.getErrors('basicAuthUsername'), |
297 | | - disabled: readOnly, |
298 | | - }) }} |
299 | | - {{ forms.autosuggestField({ |
300 | | - type: 'password', |
301 | | - label: 'Password'|t('sherlock'), |
302 | | - name: (isLite ? '' : 'basicAuthPassword'), |
303 | | - instructions: 'A password to use for basic authentication when accessing the site.'|t('sherlock'), |
| 287 | + {{ forms.lightswitchField({ |
| 288 | + label: 'Basic Auth'|t('sherlock'), |
| 289 | + name: (isLite ? '' : 'basicAuthEnabled'), |
| 290 | + instructions: 'Whether to enable basic authentication when accessing the site.'|t('sherlock'), |
304 | 291 | suggestEnvVars: true, |
305 | 292 | suggestions: craft.cp.getEnvSuggestions(), |
306 | | - warning: (config.basicAuthPassword is defined ? configWarning('basicAuthPassword')), |
307 | | - value: (isLite ? '' : settings.basicAuthPassword), |
308 | | - errors: settings.getErrors('basicAuthPassword'), |
| 293 | + warning: (config.basicAuthEnabled is defined ? configWarning('basicAuthEnabled')), |
| 294 | + value: (isLite ? '' : settings.basicAuthEnabled), |
| 295 | + errors: settings.getErrors('basicAuthEnabled'), |
309 | 296 | disabled: readOnly, |
| 297 | + toggle: 'basicAuth', |
310 | 298 | }) }} |
| 299 | + <div id="basicAuth" class="hidden"> |
| 300 | + {{ forms.autosuggestField({ |
| 301 | + label: 'Username'|t('sherlock'), |
| 302 | + name: (isLite ? '' : 'basicAuthUsername'), |
| 303 | + instructions: 'A username to use for basic authentication when accessing the site.'|t('sherlock'), |
| 304 | + suggestEnvVars: true, |
| 305 | + suggestions: craft.cp.getEnvSuggestions(), |
| 306 | + warning: (config.basicAuthUsername is defined ? configWarning('basicAuthUsername')), |
| 307 | + value: (isLite ? '' : settings.basicAuthUsername), |
| 308 | + errors: settings.getErrors('basicAuthUsername'), |
| 309 | + disabled: readOnly, |
| 310 | + }) }} |
| 311 | + {{ forms.autosuggestField({ |
| 312 | + label: 'Password'|t('sherlock'), |
| 313 | + name: (isLite ? '' : 'basicAuthPassword'), |
| 314 | + instructions: 'A password to use for basic authentication when accessing the site.'|t('sherlock'), |
| 315 | + suggestEnvVars: true, |
| 316 | + suggestions: craft.cp.getEnvSuggestions(), |
| 317 | + warning: (config.basicAuthPassword is defined ? configWarning('basicAuthPassword')), |
| 318 | + value: (isLite ? '' : settings.basicAuthPassword), |
| 319 | + errors: settings.getErrors('basicAuthPassword'), |
| 320 | + disabled: readOnly, |
| 321 | + }) }} |
| 322 | + </div> |
311 | 323 | {% endset %} |
312 | 324 |
|
313 | 325 | {% include 'sherlock/_includes/paidFields' %} |
|
0 commit comments