关于login重构
This commit is contained in:
@@ -143,6 +143,7 @@ app
|
||||
path: 'org',
|
||||
key: 'hasUser',
|
||||
middleware: ['auth'],
|
||||
description: '判断当前username这个组织,是否在当前用户的组织中。如果有,返回当前组织的用户信息,否则返回null',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const tokenUser = ctx.state.tokenUser;
|
||||
@@ -159,7 +160,13 @@ app
|
||||
};
|
||||
return;
|
||||
}
|
||||
const usernameUser = await User.findOne({ where: { username } });
|
||||
const usernameUser = await User.findOne({
|
||||
where: { username },
|
||||
attributes: {
|
||||
exclude: ['password', 'salt'],
|
||||
},
|
||||
});
|
||||
|
||||
if (!usernameUser) {
|
||||
ctx.body = {
|
||||
uid: null,
|
||||
|
||||
Reference in New Issue
Block a user