Skip to content

Commit

Permalink
fixup! Force the user to scroll text to accept the TOS
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed Jul 17, 2024
1 parent 8dd3ef4 commit 25dcddf
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Registration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<NcModal v-if="showModal"
:can-close="hasSigned"
@close="handleCloseModal">
<ModalContent @click="acceptTerms">
<ModalContent :is-scroll-complete="hasScrolledToBottom" @click="acceptTerms">
<template #header>
<h3>{{ t('terms_of_service', 'Terms of service') }}</h3>
<select v-if="terms.length > 1" v-model="selectedLanguage">
Expand All @@ -35,7 +35,10 @@
</template>

<!-- eslint-disable-next-line vue/no-v-html -->
<div class="text-content" v-html="termsBody" />
<div ref="termsContent"
class="text-content"
@scroll="checkScroll"
v-html="termsBody" />

Check warning on line 41 in src/Registration.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'v-html' directive can lead to XSS attack
</ModalContent>
</NcModal>
</div>
Expand Down Expand Up @@ -68,6 +71,7 @@ export default {
termsId: 0,
termsBody: '',
publicContent: null,
hasScrolledToBottom: false,
}
},

Expand Down Expand Up @@ -128,6 +132,14 @@ export default {
return
}
this.showModal = true
this.$nextTick(() => {
this.checkScroll()
})
},
checkScroll() {
const termsContent = this.$refs.termsContent
const isScrollable = termsContent.scrollHeight > termsContent.clientHeight
this.hasScrolledToBottom = !isScrollable || (termsContent.scrollHeight - termsContent.scrollTop <= termsContent.clientHeight + 1)
},

acceptTerms() {
Expand Down

0 comments on commit 25dcddf

Please sign in to comment.