fix: hide user password
This commit is contained in:
parent
4ed74bfedf
commit
6bfd8ebf57
@ -3,8 +3,14 @@ import { PASSWORD } from '@nocobase/database';
|
||||
import cryptoRandomString from 'crypto-random-string';
|
||||
|
||||
export async function check(ctx: actions.Context, next: actions.Next) {
|
||||
ctx.body = ctx.state.currentUser;
|
||||
await next();
|
||||
if (ctx.state.currentUser) {
|
||||
const user = ctx.state.currentUser.toJSON();
|
||||
delete user.password;
|
||||
ctx.body = user;
|
||||
await next();
|
||||
} else {
|
||||
ctx.throw(401, 'Unauthorized');
|
||||
}
|
||||
}
|
||||
|
||||
export async function login(ctx: actions.Context, next: actions.Next) {
|
||||
|
Loading…
Reference in New Issue
Block a user