db records TOS acceptance
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
<slot v-if="s.regionApproved"/>
|
<slot v-if="s.regionApproved"/>
|
||||||
<v-card v-if="s.regionApproved===null" title="Loading..." prepend-icon="mdi-clock-outline"
|
<v-card v-if="s.regionApproved===null" title="Loading..." prepend-icon="mdi-clock-outline"
|
||||||
text="If loading takes more than a second, please refresh your browser or contact support@dexorder.trade"/>
|
text="If loading takes more than a second, please refresh your browser or contact support@dexorder.trade"/>
|
||||||
<v-card v-if="s.regionApproved===false" title="Restricted" prepend-icon="mdi-alert"
|
<v-card v-if="s.regionApproved===false" title="Restricted" prepend-icon="mdi-alert" color="yellow-darken-1"
|
||||||
text="Dexorder is not available in your region."/>
|
text="Dexorder is not available in your region." rounded="0"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<v-dialog v-model="show" max-width="500px" persistent>
|
<v-dialog v-model="show" max-width="500px" persistent>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title class="text-center">Dexorder Terms of Service</v-card-title>
|
<v-card-title class="text-center">Dexorder Terms of Service</v-card-title>
|
||||||
|
<!-- MAKE SURE TO UPDATE THE VERSION VARIABLE AS WELL -->
|
||||||
<v-card-text class="text-center">Last Updated November 18, 2024</v-card-text>
|
<v-card-text class="text-center">Last Updated November 18, 2024</v-card-text>
|
||||||
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
@@ -659,31 +660,30 @@ at <a href="mailto:legal@dexorder.trade">legal@dexorder.trade</a> or <a href="ma
|
|||||||
import {usePrefStore} from "@/store/store.js";
|
import {usePrefStore} from "@/store/store.js";
|
||||||
import {computed, ref, watch} from "vue";
|
import {computed, ref, watch} from "vue";
|
||||||
|
|
||||||
import {timestamp} from "@/common.js";
|
import {socket} from "@/socket.js";
|
||||||
|
|
||||||
// INCREMENT THIS WHEN CHANGING THE TOS
|
// UPDATE THIS WHEN CHANGING THE TOS
|
||||||
const CURRENT_VERSION=1
|
const CURRENT_VERSION='2024-11-18' // this must be a parseable date
|
||||||
|
|
||||||
const prefs = usePrefStore()
|
const prefs = usePrefStore()
|
||||||
const ok = computed(()=>{
|
const ok = computed(()=>{
|
||||||
console.log('check ToS', prefs.acceptedTos)
|
console.log('check ToS', prefs.acceptedTos)
|
||||||
return prefs.acceptedTos!==null&&prefs.acceptedTos.version===CURRENT_VERSION
|
return prefs.acceptedTos===CURRENT_VERSION
|
||||||
})
|
})
|
||||||
const show = computed(()=>!ok.value)
|
const show = computed(()=>!ok.value)
|
||||||
const acceptable = computed(()=>!inFlight.value)
|
const acceptable = computed(()=>!inFlight.value)
|
||||||
const inFlight = ref(false)
|
const inFlight = ref(false)
|
||||||
|
|
||||||
watch(ok, (newVal, oldVal)=> {console.log('check ToS');if(newVal!==oldVal) console.log('ToS accepted', prefs.acceptedTos.version, prefs.acceptedTos.date) })
|
watch(ok, (newVal, oldVal)=> {console.log('check ToS');if(newVal!==oldVal) console.log('ToS accepted', prefs.acceptedTos, prefs.acceptedTos) })
|
||||||
|
|
||||||
function accept() {
|
function accept() {
|
||||||
prefs.acceptedTos = {
|
inFlight.value = true
|
||||||
version: CURRENT_VERSION,
|
socket.emit('approveTOS', new Date().toISOString(), CURRENT_VERSION, (ok)=>{
|
||||||
date: timestamp(),
|
console.log('approve TOS', ok)
|
||||||
// todo IP check
|
if (ok) prefs.acceptedTos = CURRENT_VERSION
|
||||||
// ip: '127.0.0.1',
|
else console.warn('TOS was not approved')
|
||||||
// country: 'AD'
|
inFlight.value = false
|
||||||
}
|
})
|
||||||
inFlight.value = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function decline() {
|
function decline() {
|
||||||
@@ -698,4 +698,4 @@ function decline() {
|
|||||||
margin-left: 2em;
|
margin-left: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ export const usePrefStore = defineStore({
|
|||||||
state: ()=> {
|
state: ()=> {
|
||||||
// user preferences
|
// user preferences
|
||||||
const inverted = ref({})
|
const inverted = ref({})
|
||||||
const acceptedTos = ref(null)
|
const acceptedTos = ref('NO TOS ACCEPTED')
|
||||||
return {inverted, acceptedTos,}
|
return {inverted, acceptedTos,}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user