Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2022-06-26 19:25:42 +0300
committerdartcafe <github@dartcafe.de>2022-06-26 19:25:42 +0300
commit96493d7026906d06cb09dfed1c131cc20b4d514e (patch)
tree0612c49dc16cf408c38ac7128fe0a88e031ed07d /src/js/components
parente4fe40d48a83e05abbc8800b655865199a28fae6 (diff)
logout from public pollenh/logout-from-public-poll
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/components')
-rw-r--r--src/js/components/User/UserMenu.vue22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/js/components/User/UserMenu.vue b/src/js/components/User/UserMenu.vue
index dad7a9fd..22b2d0b6 100644
--- a/src/js/components/User/UserMenu.vue
+++ b/src/js/components/User/UserMenu.vue
@@ -28,7 +28,7 @@
<ActionButton v-if="$route.name === 'publicVote'" icon="icon-md-link" @click="copyLink()">
{{ t('polls', 'Copy your personal link to clipboard') }}
</ActionButton>
- <ActionSeparator />
+ <ActionSeparator v-if="$route.name === 'publicVote'" />
<ActionInput v-if="$route.name === 'publicVote'"
:class="check.status"
:value="emailAddressTemp"
@@ -75,6 +75,12 @@
</template>
{{ t('polls', 'Reset your votes') }}
</ActionButton>
+ <ActionButton v-if="$route.name === 'publicVote' && hasCookie" @click="logout()">
+ <template #icon>
+ <LogoutIcon />
+ </template>
+ {{ t('polls', 'Logout as {name} (delete cookie)', { name: acl.displayName }) }}
+ </ActionButton>
</Actions>
</template>
@@ -91,6 +97,8 @@ import SendLinkPerEmailIcon from 'vue-material-design-icons/LinkVariant.vue'
import DeleteIcon from 'vue-material-design-icons/Delete.vue'
import ClippyIcon from 'vue-material-design-icons/ClipboardArrowLeftOutline.vue'
import ResetVotesIcon from 'vue-material-design-icons/Undo.vue'
+import LogoutIcon from 'vue-material-design-icons/Logout.vue'
+import { deleteCookieByValue, findCookieByValue } from '../../helpers/cookieHelper.js'
export default {
name: 'UserMenu',
@@ -103,6 +111,7 @@ export default {
ActionSeparator,
SettingsIcon,
EditEmailIcon,
+ LogoutIcon,
SendLinkPerEmailIcon,
DeleteIcon,
ClippyIcon,
@@ -126,6 +135,10 @@ export default {
emailAddress: (state) => state.share.emailAddress,
}),
+ hasCookie() {
+ return !!findCookieByValue(this.$route.params.token)
+ },
+
emailAddressUnchanged() {
return this.emailAddress === this.emailAddressTemp
},
@@ -171,6 +184,13 @@ export default {
},
methods: {
+ logout() {
+ const reRouteTo = deleteCookieByValue(this.$route.params.token)
+ if (reRouteTo) {
+ this.$router.push({ name: 'publicVote', params: { token: reRouteTo } })
+ }
+ },
+
async toggleSubscription() {
await this.$store.dispatch('subscription/update', !this.subscribed)
},