diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 56a4bd113..a04360d7d 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -97,7 +97,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", @@ -475,7 +480,10 @@ "showMenu": "Show the menu", "hideMenu": "Hide the menu", "forExample": "For example:", - "welcomeBack": "Welcome Back!" + "welcomeBack": "Welcome Back!", + "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 000000000..2d7a4ebd5 --- /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 000000000..2c124ade6 --- /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 1a6beb13b..90623017b 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) }} + + {{ $t('misc.delete') }} + +
+ + + {{ $t('user.settings.caldav.tokenCreated', {token: newToken.token}) }}
+ {{ $t('user.settings.caldav.wontSeeItAgain') }} +
+ + + {{ $t('user.settings.caldav.createToken') }} + +

{{ $t('user.settings.caldav.more') }} @@ -26,12 +61,15 @@