diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index ca476f47..b272aeaf 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -105,7 +105,12 @@ "caldav": { "title": "Caldav", "howTo": "You can connect Vikunja to caldav clients to view and manage all tasks from different clients. Enter this url into your client:", - "more": "More information about caldav in Vikunja" + "more": "More information about caldav in Vikunja", + "tokens": "Caldav Tokens", + "tokensHowTo": "You can use a caldav token to use instead of a password to log in the above endpoint.", + "createToken": "Create a token", + "tokenCreated": "Here is your token: {token}", + "wontSeeItAgain": "Write it down, you won't be able to see it again." }, "avatar": { "title": "Avatar", @@ -486,7 +491,10 @@ "hideMenu": "Hide the menu", "forExample": "For example:", "welcomeBack": "Welcome Back!", - "custom": "Custom" + "custom": "Custom", + "id": "ID", + "created": "Created at", + "actions": "Actions" }, "input": { "resetColor": "Reset Color", diff --git a/src/models/caldavToken.js b/src/models/caldavToken.js new file mode 100644 index 00000000..2d7a4ebd --- /dev/null +++ b/src/models/caldavToken.js @@ -0,0 +1,15 @@ +import AbstractModel from './abstractModel' + +export default class CaldavTokenModel extends AbstractModel { + constructor(data) { + super(data) + this.created = new Date(this.created) + } + + defaults() { + return { + id: 0, + created: null, + } + } +} \ No newline at end of file diff --git a/src/services/caldavToken.js b/src/services/caldavToken.js new file mode 100644 index 00000000..2c124ade --- /dev/null +++ b/src/services/caldavToken.js @@ -0,0 +1,23 @@ +import {formatISO} from 'date-fns' +import CaldavTokenModel from '../models/caldavToken' +import AbstractService from './abstractService' + +export default class CaldavTokenService extends AbstractService { + constructor() { + super({ + getAll: '/user/settings/token/caldav', + create: '/user/settings/token/caldav', + delete: '/user/settings/token/caldav/{id}', + }) + } + + processModel(model) { + model.created = formatISO(new Date(model.created)) + return model + } + + modelFactory(data) { + return new CaldavTokenModel(data) + } +} + \ No newline at end of file diff --git a/src/views/user/settings/Caldav.vue b/src/views/user/settings/Caldav.vue index cb4189d7..e9d010a4 100644 --- a/src/views/user/settings/Caldav.vue +++ b/src/views/user/settings/Caldav.vue @@ -16,6 +16,41 @@ /> + +
+ {{ $t('user.settings.caldav.tokens') }} +
+ ++ {{ $t('user.settings.caldav.tokensHowTo') }} +
+ +{{ $t('misc.id') }} | +{{ $t('misc.created') }} | +{{ $t('misc.actions') }} | +
---|---|---|
{{ tk.id }} | +{{ formatDateShort(tk.created) }} | +
+ |
+