@kne/fastify-account 2.0.0-alpha.4 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const fp = require('fastify-plugin');
2
2
  const path = require('node:path');
3
- const {merge } = require('lodash');
3
+ const { merge } = require('lodash');
4
4
  const jwt = require('@fastify/jwt');
5
5
  const namespace = require('@kne/fastify-namespace');
6
6
  const httpErrors = require('http-errors');
@@ -8,7 +8,7 @@ const httpErrors = require('http-errors');
8
8
  const { Unauthorized } = httpErrors;
9
9
 
10
10
  const user = fp(
11
- async function (fastify, options) {
11
+ async function(fastify, options) {
12
12
  options = merge(
13
13
  {
14
14
  name: 'account',
@@ -19,11 +19,12 @@ const user = fp(
19
19
  secret: 'super-secret',
20
20
  expires: null,
21
21
  verify: {
22
- extractToken: request => request.headers['x-user-token']
22
+ extractToken: request => request.headers['x-user-token'] || request.query?.token
23
23
  }
24
24
  },
25
25
  defaultPassword: 'Aa000000!',
26
- sendMessage: async () => {}
26
+ sendMessage: async () => {
27
+ }
27
28
  },
28
29
  options
29
30
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-account",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.5",
4
4
  "description": "用于用户注册登录认证.",
5
5
  "main": "index.js",
6
6
  "scripts": {