Skip to content

Commit

Permalink
fix(ui): add warning for http nextcloud url in https daemon
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <[email protected]>
  • Loading branch information
andrey18106 committed Jul 1, 2024
1 parent c26ca32 commit 1ef1f50
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/components/DaemonConfig/RegisterDaemonConfigModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@
<label for="nextcloud-url">{{ t('app_api', 'Nextcloud URL') }}</label>
<NcInputField
id="nextcloud-url"
:helper-text="isNextcloudUrlSafeHelpText"
:input-class="!isNextcloudUrlSafe ? 'text-warning' : ''"
:value.sync="nextcloud_url"
style="max-width: 70%;"
:placeholder="t('app_api', 'Nextcloud URL')"
:aria-label="t('app_api', 'Nextcloud URL')" />
:aria-label="t('app_api', 'Nextcloud URL')"/>
</div>
<div class="row">
<NcCheckboxRadioSwitch
Expand Down Expand Up @@ -356,6 +359,15 @@ export default {
isAdditionalOptionValid() {
return this.additionalOption.key.trim() !== '' && this.additionalOption.value.trim() !== ''
},
isNextcloudUrlSafe() {
if (this.httpsEnabled) {
return this.nextcloud_url.startsWith('https://')
}
return this.nextcloud_url.startsWith('http://') || this.nextcloud_url.startsWith('https://')
},
isNextcloudUrlSafeHelpText() {
return this.isNextcloudUrlSafe ? '' : t('app_api', 'For HTTPS daemon, Nextcloud URL should be HTTPS')
},
},
watch: {
configurationTab(newConfigurationTab) {
Expand Down Expand Up @@ -542,3 +554,12 @@ export default {
}
}
</style>
<style lang="scss">
.register-daemon-config-body {
.input-field__input.text-warning {
border-color: var(--color-warning-text) !important;
color: var(--color-warning-text) !important;
}
}
</style>

0 comments on commit 1ef1f50

Please sign in to comment.