-
Notifications
You must be signed in to change notification settings - Fork 1
code review session1 #1
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
base: master
Are you sure you want to change the base?
Changes from all commits
bda9c0b
fde9288
33408ba
6dc947d
1a050f2
e85b9e3
73301d4
96fb52e
3b2b07f
1648aa9
34a7fcd
70b4062
15b7bb0
9d29cf9
9e912a4
b27e8f3
c1331c7
c95fe1f
2c64d9f
315f1fc
f5064a5
90c7ec2
b348049
c8d5c2f
77cebae
a0a293d
950a3fb
300b0ba
c425038
1fc05e6
19cc053
3dc889e
4e362ab
04aefb7
6161f5f
41f080c
3980442
3397e30
7546960
a46a621
cab3ee4
5c14dc3
61fdb19
adcda5d
8aaa93d
a5e4e11
ce56ab2
efa33af
12cb0f6
69b0376
d27f213
715fe83
ef7e1e4
7bf62cf
5472245
81350da
f296b7e
fdad3b7
f622ced
c0d2f37
b15367f
543d0e6
4c3d88c
b5223fe
5c3f668
65b8401
baf80ff
cef977d
5249560
5823176
96e1a8f
af44d87
834b3cd
0266921
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,5 @@ node_modules/ | |
| img/ | ||
| Queries/ | ||
| Excel/ | ||
| backup/ | ||
| *.cashe | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,6 @@ | |
| # *.[oa] | ||
| # *~ | ||
| node_modules/ | ||
| backup/ | ||
| img/ | ||
| *.cashe | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,47 +41,49 @@ exports.validateUser = async (req, res) => { | |
|
|
||
| const [row] = await auth.validateUser(req.body.login); | ||
|
|
||
| const dbUser = row[0]; | ||
|
|
||
| console.log("row:", row); | ||
|
|
||
| if (row.length > 0) { | ||
| let passwordEnteredByUser = req.body.pass; | ||
| let salt = row[0].salt; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here and in all pull request - use |
||
| let salt = dbUser.salt; | ||
|
|
||
| console.log("salt:", salt); | ||
|
|
||
|
|
||
| if (bcrypt.hashSync(passwordEnteredByUser, salt) === row[0].crypto) { | ||
| if (bcrypt.hashSync(passwordEnteredByUser, salt) === dbUser.crypto) { | ||
|
|
||
| let user = {}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const user = {}, const name = {} etc |
||
|
|
||
| user.id = row[0].id; | ||
| user.login = row[0].login; | ||
| user.id = dbUser.id; | ||
| user.login = dbUser.login; | ||
| let name = {}; | ||
| name.firstName = row[0].firstName; | ||
| name.lastName = row[0].lastName; | ||
| name.patronymic = row[0].patrName; | ||
| name.fullName = row[0].fullName; | ||
| name.firstName = dbUser.firstName; | ||
| name.lastName = dbUser.lastName; | ||
| name.patronymic = dbUser.patrName; | ||
| name.fullName = dbUser.fullName; | ||
| user.name = name; | ||
| name.avatar = row[0].avatar; | ||
| name.avatar = dbUser.avatar; | ||
| let role = {}; | ||
| role.id = row[0].idRole; | ||
| role.name = row[0].role; | ||
| role.id = dbUser.idRole; | ||
| role.name = dbUser.role; | ||
| user.role = role; | ||
| let contacts = {}; | ||
| contacts.phone1 = row[0].phone1; | ||
| contacts.phone2 = row[0].phone2; | ||
| contacts.email = row[0].email; | ||
| contacts.phone1 = dbUser.phone1; | ||
| contacts.phone2 = dbUser.phone2; | ||
| contacts.email = dbUser.email; | ||
| user.contacts = contacts; | ||
| let warehouse = {}; | ||
| warehouse.id = row[0].idWarehouse; | ||
| warehouse.name = row[0].warehouse; | ||
| warehouse.id = dbUser.idWarehouse; | ||
| warehouse.name = dbUser.warehouse; | ||
| user.warehouse = warehouse; | ||
| let department = {}; | ||
| department.id = row[0].idDepartment; | ||
| department.name = row[0].department; | ||
| department.id = dbUser.idDepartment; | ||
| department.name = dbUser.department; | ||
| user.department = department; | ||
|
|
||
| console.log("row[0]:", row[0]); | ||
| console.log("dbUser:", dbUser); | ||
| console.log("user:", user); | ||
| const accessToken = jwt.sign({ username: user.username, role: user.role, id: user.id }, accessTokenSecret, { expiresIn: '120m' }); | ||
| const refreshToken = jwt.sign({ username: user.username, role: user.role, id: user.id }, refreshTokenSecret); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in all pull request - remove
console.log. They are needed only in development