+ create user with public/private key
+ sign and verify votes and prevent unverified updates
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
<div>
|
||||
<h2 class="poll-title">Poll: {{ activePollId }}</h2>
|
||||
<p v-if="Object.keys(pollData).length==0">Note: Add at least one Option to save the Poll.</p>
|
||||
<form @submit.prevent="handleAddNewOption" class="add-option-form">
|
||||
<form @submit.prevent="handleAddNewOption" class="add-option-form" v-if="userid">
|
||||
<input v-model="newOption" placeholder="Enter a new poll option..." required />
|
||||
<button type="submit">Add Option</button>
|
||||
</form>
|
||||
@@ -54,7 +54,7 @@
|
||||
<span class="option-name">{{ optionName }}</span>
|
||||
<div class="vote-section">
|
||||
<span class="vote-count">{{ votes.length }} {{ votes.length === 1 ? 'vote' : 'votes' }}</span>
|
||||
<button @click="vote(String(optionName),String(userGuid))" class="vote-btn" :disabled="voted(votes)">+1</button>
|
||||
<button @click="vote(String(optionName))" class="vote-btn" :disabled="userid==undefined || voted(votes)">+1</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -71,11 +71,10 @@
|
||||
newOption.value = '';
|
||||
};
|
||||
|
||||
const userGuid = useCookie('user_guid');
|
||||
|
||||
const voted = (votes: SignedData<VoteData>[]) => {
|
||||
for(let vote of votes){
|
||||
if(vote.data.userid == userGuid.value){
|
||||
if(vote.data.userid == props.userid){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user