diff --git a/composables/useAuthFetch.js b/composables/useAuthFetch.js index 9e95d4a..72e7d40 100644 --- a/composables/useAuthFetch.js +++ b/composables/useAuthFetch.js @@ -1,18 +1,6 @@ export const useAuthFetch = async (url, options = {}) => { const { $auth } = useNuxtApp() - const token = await $auth.retrieveToken() - - if (!token) { - return await $auth.redirectToLogin() - } - - options = Object.assign(options, { - headers: { - 'Authorization': 'Bearer ' + token - } - }) - const res = await useFetch(url, options) if (res.error.value && res.error.value.status === 401) { await $auth.logout() diff --git a/docker-compose.yml b/docker-compose.yml index 8083a24..15320e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,12 @@ services: - DJANGO_SUPERUSER_USERNAME=admin # default superuser name - DJANGO_SUPERUSER_PASSWORD=password # default superuser password - DJANGO_SUPERUSER_EMAIL=admin@example.com # default superuser email + # If you want to use the email verification function, you need to configure the following parameters +# - EMAIL_HOST=SMTP server address +# - EMAIL_PORT=SMTP server port +# - EMAIL_HOST_USER= +# - EMAIL_HOST_PASSWORD= +# - EMAIL_USE_TLS=True ports: - '8000:8000' networks: diff --git a/pages/account/onboarding.vue b/pages/account/onboarding.vue index 687faba..cf34e02 100644 --- a/pages/account/onboarding.vue +++ b/pages/account/onboarding.vue @@ -3,18 +3,29 @@ definePageMeta({ layout: 'vuetify-app', middleware: ['auth'] }) -const email = ref('') +const route = useRoute() const sending = ref(false) +const resent = ref(false) +const errorMsg = ref(null) const resendEmail = async () => { + errorMsg.value = null sending.value = true - const { data, error } = await useFetch('/api/account/resend-verification-email/', { - method: 'POST' + const { data, error } = await useFetch('/api/account/registration/resend-email/', { + method: 'POST', }) if (error.value) { - console.log(error.value) + errorMsg.value = 'Something went wrong. Please try again later.' + } else { + resent.value = true } sending.value = false } + +onNuxtReady(() => { + if (route.query.resend) { + resendEmail() + } +})