diff --git a/components/global/LoginCard.vue b/components/global/LoginCard.vue index 8216b38..4619509 100644 --- a/components/global/LoginCard.vue +++ b/components/global/LoginCard.vue @@ -45,7 +45,8 @@ async function signInWithPassword() { loading.value = true const { error, url } = await signIn('credentials', { - ...signInModel.value, + email: signInModel.value.email, + password: signInModel.value.password, redirect: false, }) diff --git a/nuxt.config.ts b/nuxt.config.ts index 7fd277e..6d83825 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -96,11 +96,11 @@ export default defineNuxtConfig({ }, }, auth: { - provider: { - type: 'authjs', - }, - globalAppMiddleware: { - isEnabled: true, + isEnabled: true, + enableGlobalAppMiddleware: true, + globalMiddlewareOptions: { + allow404WithoutAuth: true, + addDefaultCallbackUrl: true, }, }, build: { diff --git a/package.json b/package.json index a197570..3695883 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@nuxtjs/color-mode": "^3.3.0", "@pinia-plugin-persistedstate/nuxt": "^1.1.1", "@pinia/nuxt": "^0.4.11", - "@sidebase/nuxt-auth": "^0.6.0-beta.5", + "@sidebase/nuxt-auth": "^0.5.0", "@types/async": "^3.2.20", "@types/jsdom": "^21.1.2", "@types/qrcode": "^1.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e4f867d..1d2fe41 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,8 +47,8 @@ devDependencies: specifier: ^0.4.11 version: 0.4.11(rollup@2.79.1)(typescript@5.2.2)(vue@3.3.4) '@sidebase/nuxt-auth': - specifier: ^0.6.0-beta.5 - version: 0.6.0-beta.5(next-auth@4.22.5)(rollup@2.79.1)(vue@3.3.4) + specifier: ^0.5.0 + version: 0.5.0(next-auth@4.22.5)(rollup@2.79.1) '@types/async': specifier: ^3.2.20 version: 3.2.20 @@ -3326,16 +3326,13 @@ packages: - react dev: true - /@sidebase/nuxt-auth@0.6.0-beta.5(next-auth@4.22.5)(rollup@2.79.1)(vue@3.3.4): - resolution: {integrity: sha512-3MKnW/V5SX1BVzV4olBuuSDIehfmCveFJwwxP5ho63CEFmxPXUqQTQs9jzjBJ1NUJnOsH/BIjkkun0lVfcr9tg==} + /@sidebase/nuxt-auth@0.5.0(next-auth@4.22.5)(rollup@2.79.1): + resolution: {integrity: sha512-Zq0laKbRjX3luAJrkSTYE9gkLttFO5LiWB9qq5xiYQGmtKxY9cu8sk9KeUVZ3z6shjEqHdtwM5FFCKGGvwVALA==} peerDependencies: next-auth: ^4.21.1 dependencies: '@nuxt/kit': 3.7.0(rollup@2.79.1) - '@vueuse/core': 9.13.0(vue@3.3.4) defu: 6.1.2 - h3: 1.8.1 - knitwork: 1.0.0 next-auth: 4.22.5(next@13.4.19)(react-dom@18.2.0)(react@18.2.0) nitropack: 2.6.2 requrl: 3.0.2 @@ -3351,12 +3348,10 @@ packages: - '@planetscale/database' - '@upstash/redis' - '@vercel/kv' - - '@vue/composition-api' - encoding - idb-keyval - rollup - supports-color - - vue dev: true /@sideway/address@4.1.4: @@ -3634,10 +3629,6 @@ packages: resolution: {integrity: sha512-MFETx3tbTjE7Uk6vvnWINA/1iJ7LuMdO4fcq8UfF0pRbj01aGLduVvQcRyswuACJdpnHgg8E3rQLhaRdNEJS0w==} dev: true - /@types/web-bluetooth@0.0.16: - resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==} - dev: true - /@types/web-bluetooth@0.0.17: resolution: {integrity: sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==} dev: true @@ -4322,18 +4313,6 @@ packages: - vue dev: true - /@vueuse/core@9.13.0(vue@3.3.4): - resolution: {integrity: sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==} - dependencies: - '@types/web-bluetooth': 0.0.16 - '@vueuse/metadata': 9.13.0 - '@vueuse/shared': 9.13.0(vue@3.3.4) - vue-demi: 0.14.6(vue@3.3.4) - transitivePeerDependencies: - - '@vue/composition-api' - - vue - dev: true - /@vueuse/head@1.3.1(vue@3.3.4): resolution: {integrity: sha512-XCcHGfDzkGlHS7KIPJVYN//L7jpfASLsN7MUE19ndHVQLnPIDxqFLDl7IROsY81PKzawVAUe4OYVWcGixseWxA==} peerDependencies: @@ -4400,10 +4379,6 @@ packages: resolution: {integrity: sha512-2Sc8X+iVzeuMGHr6O2j4gv/zxvQGGOYETYXEc41h0iZXIRnRbJZGmY/QP8dvzqUelf8vg0p/yEA5VpCEu+WpZg==} dev: true - /@vueuse/metadata@9.13.0: - resolution: {integrity: sha512-gdU7TKNAUVlXXLbaF+ZCfte8BjRJQWPCa2J55+7/h+yDtzw3vOoGQDRXzI6pyKyo6bXFT5/QoPE4hAknExjRLQ==} - dev: true - /@vueuse/nuxt@10.4.1(nuxt@3.6.5)(rollup@2.79.1)(vue@3.3.4): resolution: {integrity: sha512-tJ25KCkozZaQEy0qli4Ta8WXlbMIjSD7gPnVfLScZ2DpSSgImMB5R66PQEkrbSg4GfFj0OuoYc4+vCHQ/FqTsw==} peerDependencies: @@ -4431,15 +4406,6 @@ packages: - vue dev: true - /@vueuse/shared@9.13.0(vue@3.3.4): - resolution: {integrity: sha512-UrnhU+Cnufu4S6JLCPZnkWh0WwZGUp72ktOF2DFptMlOs3TOdVv8xJN53zhHGARmVOsz5KqOls09+J1NR6sBKw==} - dependencies: - vue-demi: 0.14.6(vue@3.3.4) - transitivePeerDependencies: - - '@vue/composition-api' - - vue - dev: true - /@webassemblyjs/ast@1.11.6: resolution: {integrity: sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==} dependencies: diff --git a/server/api/auth/[...].ts b/server/api/auth/[...].ts index 6fdf20a..90e0846 100644 --- a/server/api/auth/[...].ts +++ b/server/api/auth/[...].ts @@ -8,7 +8,7 @@ interface Credentials { } export default NuxtAuthHandler({ - secret: process.env.AUTH_SECRET || 'chaoxing-sing-123', + secret: process.env.AUTH_SECRET || 'chaoxing-sing', callbacks: { jwt: async ({ token, user }) => { const isSignIn = !!user diff --git a/server/api/auth/signUp.ts b/server/api/auth/signUp.post.ts similarity index 100% rename from server/api/auth/signUp.ts rename to server/api/auth/signUp.post.ts