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
toror33
2020-06-02 20:26:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
74073a15453bcdee363287601a4e0a27ecf70bcb
74073a15
1 parent
77900148
사용자 탈퇴 기능 추가
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
backend/routes/userlogin/user.js
backend/routes/userlogin/user.js
View file @
74073a1
...
...
@@ -30,7 +30,30 @@ router.post('/update', function(req, res, next) {
}
});
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