Skip to content

Commit 184b401

Browse files
feat: add auth middleware
1 parent 6223c1e commit 184b401

12 files changed

Lines changed: 20377 additions & 1453 deletions

File tree

auto-imports.d.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/* eslint-disable */
2+
/* prettier-ignore */
3+
// @ts-nocheck
4+
// noinspection JSUnusedGlobalSymbols
5+
// Generated by unplugin-auto-import
6+
// biome-ignore lint: disable
7+
export {}
8+
declare global {
9+
const EffectScope: typeof import('vue')['EffectScope']
10+
const computed: typeof import('vue')['computed']
11+
const createApp: typeof import('vue')['createApp']
12+
const customRef: typeof import('vue')['customRef']
13+
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
14+
const defineComponent: typeof import('vue')['defineComponent']
15+
const defineNuxtConfig: typeof import('nuxt/config')['defineNuxtConfig']
16+
const defineNuxtPlugin: typeof import('#app')['defineNuxtPlugin']
17+
const defineNuxtRouteMiddleware: typeof import('#app')['defineNuxtRouteMiddleware']
18+
const effectScope: typeof import('vue')['effectScope']
19+
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
20+
const getCurrentScope: typeof import('vue')['getCurrentScope']
21+
const h: typeof import('vue')['h']
22+
const inject: typeof import('vue')['inject']
23+
const isProxy: typeof import('vue')['isProxy']
24+
const isReactive: typeof import('vue')['isReactive']
25+
const isReadonly: typeof import('vue')['isReadonly']
26+
const isRef: typeof import('vue')['isRef']
27+
const markRaw: typeof import('vue')['markRaw']
28+
const navigateTo: typeof import('#app')['navigateTo']
29+
const nextTick: typeof import('vue')['nextTick']
30+
const onActivated: typeof import('vue')['onActivated']
31+
const onBeforeMount: typeof import('vue')['onBeforeMount']
32+
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
33+
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
34+
const onDeactivated: typeof import('vue')['onDeactivated']
35+
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
36+
const onMounted: typeof import('vue')['onMounted']
37+
const onRenderTracked: typeof import('vue')['onRenderTracked']
38+
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
39+
const onScopeDispose: typeof import('vue')['onScopeDispose']
40+
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
41+
const onUnmounted: typeof import('vue')['onUnmounted']
42+
const onUpdated: typeof import('vue')['onUpdated']
43+
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
44+
const provide: typeof import('vue')['provide']
45+
const reactive: typeof import('vue')['reactive']
46+
const readonly: typeof import('vue')['readonly']
47+
const ref: typeof import('vue')['ref']
48+
const resolveComponent: typeof import('vue')['resolveComponent']
49+
const shallowReactive: typeof import('vue')['shallowReactive']
50+
const shallowReadonly: typeof import('vue')['shallowReadonly']
51+
const shallowRef: typeof import('vue')['shallowRef']
52+
const toRaw: typeof import('vue')['toRaw']
53+
const toRef: typeof import('vue')['toRef']
54+
const toRefs: typeof import('vue')['toRefs']
55+
const toValue: typeof import('vue')['toValue']
56+
const triggerRef: typeof import('vue')['triggerRef']
57+
const unref: typeof import('vue')['unref']
58+
const useAttrs: typeof import('vue')['useAttrs']
59+
const useAuth: typeof import('#imports')['useAuth']
60+
const useCssModule: typeof import('vue')['useCssModule']
61+
const useCssVars: typeof import('vue')['useCssVars']
62+
const useId: typeof import('vue')['useId']
63+
const useModel: typeof import('vue')['useModel']
64+
const useRuntimeConfig: typeof import('#app')['useRuntimeConfig']
65+
const useSlots: typeof import('vue')['useSlots']
66+
const useState: typeof import('#app')['useState']
67+
const useTemplateRef: typeof import('vue')['useTemplateRef']
68+
const watch: typeof import('vue')['watch']
69+
const watchEffect: typeof import('vue')['watchEffect']
70+
const watchPostEffect: typeof import('vue')['watchPostEffect']
71+
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
72+
}
73+
// for type re-export
74+
declare global {
75+
// @ts-ignore
76+
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
77+
import('vue')
78+
}

docs/guide/authentication.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
Learn how the authentication system works in Nuxt Users.
44

5+
## Whitelisting Routes
6+
7+
By default, all pages require authentication. You can whitelist routes that should be accessible without authentication using the `auth.whitelist` option in your `nuxt.config.ts`.
8+
9+
By default, the login page is already whitelisted. If you want to add other pages, like a register page, you can do so like this:
10+
11+
```ts
12+
export default defineNuxtConfig({
13+
modules: ['nuxt-users'],
14+
nuxtUsers: {
15+
auth: {
16+
whitelist: ['/login', '/register'],
17+
},
18+
},
19+
})
20+
```
21+
522
## Overview
623

724
The module provides a complete authentication system with:

0 commit comments

Comments
 (0)