Skip to content

Commit

Permalink
🐛 bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Dec 18, 2022
1 parent 41aa172 commit 0b8b18a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ async function get(req, res) {
let message = 'ok';
try {
user = await User.findOne({
attributes: { exclude: ['password'] },
where: {
id
},
Expand All @@ -129,7 +130,10 @@ async function getAll(req, res) {
let message = 'ok';
let status = true;
try {
users = await User.findAll({ raw: true });
users = await User.findAll({
attributes: { exclude: ['password'] },
raw: true
});
} catch (e) {
status = false;
message = e.message;
Expand All @@ -139,7 +143,7 @@ async function getAll(req, res) {

async function create(req, res) {
const username = req.body.username;
const password = req.body.password;
let password = req.body.password;
let displayName = req.body.displayName;
if (!displayName) {
displayName = username;
Expand All @@ -157,6 +161,7 @@ async function create(req, res) {
message: '无效的参数'
});
}
password = hashPasswordWithSalt(password);
let message = 'ok';
let user = undefined;
try {
Expand Down

0 comments on commit 0b8b18a

Please sign in to comment.