Skip to content

Commit

Permalink
Merge branch 'api-token-expire-today' into 'main'
Browse files Browse the repository at this point in the history
Fix API token expiring today shown as expired in UI

See merge request reportcreator/reportcreator!485
  • Loading branch information
MWedl committed Mar 19, 2024
2 parents fb58bf0 + b494774 commit d0b9387
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Changelog

## Next
* Add Content Security Policy directive form-action
* Collaborative editing in notes
* Remember "Encrypt PDF" setting in browser's local storage
* Fix force change design API request not sent
* Collaborative editing in notes
* Add Content Security Policy directive form-action
* Fix API token expiring today shown as expired in UI
* Markdown editor: Improve vue template variable handling
* Markdown editor: Allow escaping curly braces

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Chip/Expires.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</template>

<script setup lang="ts">
import { formatDistanceToNow, parseISO, formatISO9075 } from 'date-fns';
import { formatDistanceToNow, parseISO, formatISO9075, endOfDay, endOfToday } from 'date-fns';
const props = withDefaults(defineProps<{
value?: string|null,
Expand All @@ -34,5 +34,5 @@ const formattedDate = computed(() => {
}
return 'in ' + formatDistanceToNow(date.value);
});
const isExpired = computed(() => date.value && date.value < new Date());
const isExpired = computed(() => date.value && endOfDay(date.value) < endOfToday());
</script>
3 changes: 3 additions & 0 deletions frontend/src/components/S/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<v-date-picker
v-model="dateValue"
:disabled="props.disabled || props.disabled"
:min="props.minDate"
view-mode="month"
show-adjacent-months
show-week
Expand All @@ -36,11 +37,13 @@ const props = withDefaults(defineProps<{
disabled?: boolean;
readonly?: boolean;
locale?: string;
minDate?: string;
}>(), {
modelValue: null,
disabled: false,
readonly: false,
locale: 'en',
minDate: undefined,
});
const emits = defineEmits<{
(e: 'update:modelValue', modelValue: string|null): void,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/pages/users/self/apitokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
v-model="setupWizard.form.expire_date"
label="Expire Date (optional)"
:error-messages="setupWizard.errors?.expire_date"
:min-date="formatISO9075(new Date(), { representation: 'date' })"
/>
</v-card-text>
<v-card-actions>
Expand Down Expand Up @@ -104,6 +105,8 @@
</template>
<script setup lang="ts">
import { formatISO9075 } from 'date-fns';
const auth = useAuth();
const apiTokens = await useAsyncDataE<ApiToken[]>(async () => {
try {
Expand Down

0 comments on commit d0b9387

Please sign in to comment.