Skip to content

Commit

Permalink
Intentado quitar securityHotspot
Browse files Browse the repository at this point in the history
  • Loading branch information
baraganio committed Apr 28, 2024
1 parent b7d7962 commit 2d0bd3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions users/authservice/auth-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ app.post('/login', async (req, res) => {
validateRequiredFields(req, ['username', 'password']);

const { username, password } = req.body;

let query = {username};
// Find the user by username in the database
const user = await User.findOne({ username });
const user = await User.findOne(query);

// Check if the user exists and verify the password
if (user && await bcrypt.compare(password, user.password)) {
Expand Down
8 changes: 5 additions & 3 deletions users/userservice/user-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const User = require('./user-model');
let mongoServer;
let app;

let newString='Egw23_f8';

const user = {
username: 'usernameTest1',
password: 'Egw23_f8',
password: newString,
};

async function addUser(user){
Expand Down Expand Up @@ -49,7 +51,7 @@ describe('User Service', () => {
it('should add a new user on POST /adduser', async () => {
const newUser = {
username: 'testuser2',
password: 'aUf54_f',
password: newString,
};

const response = await request(app).post('/adduser').send(newUser);
Expand All @@ -60,7 +62,7 @@ describe('User Service', () => {
//
it('trying to add a user without username', async () => {
const newUser = {
password: 'emcio74_ws',
password: newString,
};

const response = (await request(app).post('/adduser').send(newUser));
Expand Down

0 comments on commit 2d0bd3a

Please sign in to comment.