Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박기범
2020-06-04 19:02:30 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
e7a684f193f220d14f4fb65f863cb63881d836ac
e7a684f1
2 parents
714359ee
74073a15
Merge branch 'master' of
http://khuhub.khu.ac.kr/2020-1-CloudComputing/D_Team_Khuloud
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
backend/routes/userlogin/user.js
backend/routes/userlogin/user.js
View file @
e7a684f
...
...
@@ -20,19 +20,40 @@ router.post('/update', function(req, res, next) {
console
.
log
(
"updating user failed"
);
next
(
err
);
}
else
{
console
.
log
(
"user updated successfully"
);
res
.
redirect
(
'back'
);
res
.
status
(
200
).
send
(
'update'
);
}
});
}
else
{
console
.
log
(
"password not match"
);
res
.
redirect
(
'back'
);
res
.
status
(
404
).
send
(
err
);
}
});
router
.
post
(
'/delete'
,
function
(
req
,
res
,
next
)
{
var
user_id
=
req
.
body
.
user_id
;
var
user_pw
=
req
.
body
.
user_pw
;
var
user_pw_temp
=
cryptoM
.
encrypt
(
user_pw
);
//받아온 비밀번호를 암호화화여 임시변수에 저장
var
sqlquery
=
"SELECT user_pw FROM users WHERE user_id = ?"
;
// user_id의 비밀번호를 가져옴
connection
.
query
(
sqlquery
,
[
user_id
],
function
(
err
,
rows
)
{
if
(
rows
[
0
].
user_pw
==
user_pw_temp
)
{
// 받아온 비밀번호와 user_id의 비밀번호가 같은지 대조
var
sql
=
'delete from users where user_id = ?'
;
// 만약 같다면 삭제 진행
var
values
=
[
user_id
];
connection
.
query
(
sql
,
values
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
"delete user failed"
);
throw
err
;
}
else
{
res
.
status
(
200
).
send
(
'delete'
);
}
});
}
else
{
res
.
status
(
404
).
send
(
err
);
}
});
});
module
.
exports
=
router
;
...
...
Please
register
or
login
to post a comment