Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
eue
Commits
358a25fe
Commit
358a25fe
authored
Jul 28, 2021
by
KangMin An
Browse files
Update: 지역코드 수정을 Profile 수정으로 통합
parent
98a89331
Changes
5
Show whitespace changes
Inline
Side-by-side
server/src/controllers/userController.js
View file @
358a25fe
...
...
@@ -54,8 +54,8 @@ export const getLogin = (req, res) => {
};
// Page for Development Test.
export
const
get
SetLoccod
e
=
(
req
,
res
)
=>
{
res
.
render
(
"
setLoccod
e
"
,
{
pagename
:
"
Set Loccod
e
"
});
export
const
get
EditProfil
e
=
(
req
,
res
)
=>
{
res
.
render
(
"
edit-profil
e
"
,
{
pagename
:
"
Edit Profil
e
"
});
};
// 회원 가입 처리
...
...
@@ -170,46 +170,20 @@ export const getUserInfo = async (req, res) => {
};
// 사용자 정보 수정 요청 처리
export
const
postEditProfile
=
(
req
,
res
)
=>
{
export
const
postEditProfile
=
async
(
req
,
res
)
=>
{
const
{
cookies
:
{
acs_token
},
}
=
req
;
// 수신한 변경 내용들을 통해 DB Update.
res
.
status
(
server_status
.
code
.
ok
)
.
json
({
msg
:
server_status
.
msg
.
ok
,
content
:
"
Server OK
"
});
};
// 사용자의 지역 코드 설정 처리
export
const
postSetLoccode
=
async
(
req
,
res
)
=>
{
const
{
cookies
:
{
acs_token
},
body
:
{
loccode
},
body
:
{
nick_name
,
loc_code
},
}
=
req
;
const
decoded
=
jwt
.
decode
(
acs_token
);
await
db
.
User
.
update
(
{
loc_code
:
Number
(
loccode
)
},
{
where
:
{
email
:
decoded
.
email
}
,
logging
:
false
}
{
nick_name
:
nick_name
,
loc_code
:
loc
_
code
},
{
where
:
{
email
:
decoded
.
email
}
}
);
const
payload
=
{
email
:
decoded
.
email
,
nick_name
:
decoded
.
nick_name
,
loc_code
:
loccode
,
};
const
accessT
=
jwt
.
sign
(
payload
,
envs
.
secretKey
.
access_token
,
{
expiresIn
:
"
14d
"
,
issuer
:
"
eue.com
"
,
subject
:
"
userInfo
"
,
});
res
.
status
(
server_status
.
code
.
ok
)
.
cookie
(
"
acs_token
"
,
accessT
)
.
json
({
msg
:
server_status
.
msg
.
ok
,
content
:
"
Successfully Set Loccode
"
});
.
json
({
msg
:
server_status
.
msg
.
ok
,
content
:
"
Update Successfully
"
});
};
server/src/routers/globalRouter.js
View file @
358a25fe
...
...
@@ -3,13 +3,12 @@ import routes from "../routes";
import
{
getHome
}
from
"
../controllers/globalController
"
;
import
{
getConfirm
,
getEditProfile
,
getLogin
,
getSetLoccode
,
getSignup
,
getUserInfo
,
postEditProfile
,
postLogin
,
postSetLoccode
,
postSignup
,
}
from
"
../controllers/userController
"
;
import
{
onlyPrivate
}
from
"
../middlewares
"
;
...
...
@@ -20,7 +19,7 @@ const globalRouter = express.Router();
globalRouter
.
get
(
"
/
"
,
getHome
);
globalRouter
.
get
(
routes
.
signup
,
getSignup
);
globalRouter
.
get
(
routes
.
login
,
getLogin
);
globalRouter
.
get
(
routes
.
setLoccod
e
,
onlyPrivate
,
get
SetLoccod
e
);
globalRouter
.
get
(
routes
.
editProfil
e
,
onlyPrivate
,
get
EditProfil
e
);
// Authentication
globalRouter
.
post
(
routes
.
signup
,
postSignup
);
...
...
@@ -30,6 +29,5 @@ globalRouter.get(routes.confirm, getConfirm);
// User Info
globalRouter
.
get
(
routes
.
userinfo
,
onlyPrivate
,
getUserInfo
);
globalRouter
.
post
(
routes
.
editProfile
,
onlyPrivate
,
postEditProfile
);
globalRouter
.
post
(
routes
.
setLoccode
,
onlyPrivate
,
postSetLoccode
);
export
default
globalRouter
;
server/src/views/edit-profile.pug
0 → 100644
View file @
358a25fe
block content
.signup-form_container
form(action = routes.base + routes.editProfile, method = "post")
input(type="text", name="nick_name", require=true, placeholder="Nick Name")
input(type="number", name="loc_code", require=true, placeholder="Local Code.")
input(type="submit", value="Submit")
\ No newline at end of file
server/src/views/home.pug
View file @
358a25fe
...
...
@@ -8,3 +8,5 @@ block content
a(href=routes.base + routes.signup) 회원가입
li
a(href=routes.base + routes.login) 로그인
li
a(href=routes.base + routes.editProfile) 회원 정보 변경
\ No newline at end of file
server/src/views/setLoccode.pug
deleted
100644 → 0
View file @
98a89331
block content
.signup-form_container
form(action = routes.base + routes.setLoccode, method = "post")
input(type="number", name="loccode", require=true, placeholder="Local Code.")
input(type="submit", value="Submit")
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment