Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug causing cli demo user password wrong #214

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/apps/api/auth/auth.validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ export const postLogin = [
if (exist.length === 0) throw new Error('Email or password is wrong!');
const oldPassword = exist[0]?.password;

console.log(exist);

const samePassword = await Password.compare(password, oldPassword);
if (!samePassword) throw new Error('The email or password is wrong!');
return true;
Expand Down
12 changes: 6 additions & 6 deletions src/apps/cli/commands/users.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ async function add({ email, prod = false, verify = false, demo = false }) {
const verificationToken = crypto.randomBytes(64).toString('hex');

const newUser = {
email: faker.internet.email(),
username: faker.internet.userName(),
password: hashedPassword,
email: faker.internet.email(),
password: plainPassword,
first_name: faker.name.firstName(),
last_name: faker.name.lastName(),
birth_date: faker.date.birthdate(),
Expand All @@ -120,7 +120,7 @@ async function add({ email, prod = false, verify = false, demo = false }) {
await axios.post(`/api/auth/signup`, {
email: email,
username: newUser.username,
password: newUser.password,
password: plainPassword,
})
).data;
user.data[0].password = plainPassword;
Expand All @@ -137,7 +137,7 @@ async function add({ email, prod = false, verify = false, demo = false }) {
await axios.post(`/api/auth/signup?verify=true`, {
email: email,
username: newUser.username,
password: newUser.password,
password: plainPassword,
})
).data;
user.data[0].password = plainPassword;
Expand All @@ -154,7 +154,7 @@ async function add({ email, prod = false, verify = false, demo = false }) {
await axios.post(`/api/auth/signup?verify=true`, {
email: newUser.email,
username: newUser.username,
password: newUser.password,
password: plainPassword,
})
).data;
user.data[0].password = plainPassword;
Expand All @@ -171,7 +171,7 @@ async function add({ email, prod = false, verify = false, demo = false }) {
{
email: newUser.email,
username: newUser.username,
password: newUser.password,
password: hashedPassword,
},
verificationToken,
);
Expand Down