123456789101112 |
- 'use strict';
- module.exports = options => {
- return async function password(ctx, next) {
- // mongodb中secret转换为密码类型
- if (ctx.request.method !== 'GET' && !ctx.request.url.includes('login')) {
- const body = ctx.request.body;
- if (body && body.password) body.password = { secret: body.password };
- }
- await next();
- };
- };
|