@kne/fastify-account 2.0.5 → 2.0.7

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.
@@ -235,18 +235,20 @@ const accountController = fp(async (fastify, options) => {
235
235
  tags: ['账号'], summary: '忘记密码', body: {
236
236
  oneOf: [{
237
237
  type: 'object', required: ['email'], properties: {
238
- email: { type: 'string', description: '邮箱' }
238
+ email: { type: 'string', description: '邮箱' }, referer: { type: 'string', description: '来源' }
239
239
  }
240
240
  }, {
241
241
  type: 'object', required: ['phone'], properties: {
242
- phone: { type: 'string', description: '手机号' }
242
+ phone: { type: 'string', description: '手机号' }, referer: { type: 'string', description: '来源' }
243
243
  }
244
244
  }]
245
245
  }
246
246
  }
247
247
  }, async request => {
248
248
  const name = request.body.email || request.body.phone;
249
- const token = await services.account.sendJWTVerificationCode({ name, type: 5 });
249
+ const token = await services.account.sendJWTVerificationCode({
250
+ name, type: 5, options: { referer: request.body.referer }
251
+ });
250
252
  return options.isTest ? { token } : {};
251
253
  });
252
254
 
@@ -56,6 +56,7 @@ const accountService = fp(async (fastify, options) => {
56
56
 
57
57
  const sendVerificationCode = async ({ name, type, options: otherOptions }) => {
58
58
  // messageType: 0:短信验证码,1:邮件验证码 type: 0:注册,2:登录,4:验证租户管理员,5:忘记密码
59
+ name = name.toLowerCase();
59
60
  const code = await generateVerificationCode({ name, type });
60
61
  const isEmail = userNameIsEmail(name);
61
62
  // 这里写发送逻辑
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-account",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "用于用户注册登录认证.",
5
5
  "main": "index.js",
6
6
  "scripts": {