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
c0a4250c
Commit
c0a4250c
authored
Jul 21, 2021
by
Spark
Browse files
Merge remote-tracking branch 'origin/kangmin' into who
parents
3a8a3611
a675d529
Changes
5
Show whitespace changes
Inline
Side-by-side
server/src/controllers/locCodeController.js
deleted
100644 → 0
View file @
3a8a3611
import
db
from
"
../db/index
"
;
import
{
serverMSG
,
statusCode
}
from
"
../serverinfo
"
;
// Do Code에 대한 GET 요청 처리
export
const
getDoe
=
async
(
req
,
res
)
=>
{
const
result
=
await
db
.
Doe
.
findAll
({
logging
:
false
});
if
(
result
)
{
res
.
status
(
statusCode
.
ok
).
json
({
DO
:
result
});
}
else
{
res
.
status
(
statusCode
.
err
).
send
(
serverMSG
.
server_err
);
}
};
// SGG Code에 대한 GET 요청 처리
export
const
getSGG
=
async
(
req
,
res
)
=>
{
const
{
params
:
{
id
},
}
=
req
;
const
result
=
await
db
.
Sgg
.
findAll
({
where
:
{
code_doe
:
Number
(
id
)
},
logging
:
false
,
});
if
(
result
)
{
res
.
status
(
statusCode
.
ok
).
json
({
DO
:
Number
(
id
),
SGG
:
result
});
}
else
{
console
.
log
(
result
);
res
.
status
(
statusCode
.
err
).
send
(
serverMSG
.
server_err
);
}
};
// EMD Code에 대한 GET 요청 처리
export
const
getEMD
=
async
(
req
,
res
)
=>
{
const
{
params
:
{
id
},
}
=
req
;
const
result
=
await
db
.
Emd
.
findAll
({
where
:
{
code_sgg
:
Number
(
id
)
},
logging
:
false
,
});
if
(
result
)
{
res
.
status
(
statusCode
.
ok
).
json
({
SGG
:
Number
(
id
),
EMD
:
result
});
}
else
{
console
.
log
(
result
);
res
.
status
(
statusCode
.
err
).
send
(
serverMSG
.
server_err
);
}
};
server/src/controllers/userController.js
View file @
c0a4250c
...
@@ -26,9 +26,11 @@ const postMail = async (email, token) => {
...
@@ -26,9 +26,11 @@ const postMail = async (email, token) => {
from
:
`EUE Auth Supply <
${
process
.
env
.
NODEMAILER_USER
}
>`
,
from
:
`EUE Auth Supply <
${
process
.
env
.
NODEMAILER_USER
}
>`
,
to
:
email
,
to
:
email
,
subject
:
"
EUE 사용자 계정 확인용 메일.
"
,
subject
:
"
EUE 사용자 계정 확인용 메일.
"
,
html
:
`<a href="
${
process
.
env
.
HOST
}
:
${
process
.
env
.
PORT
}${
html
:
`<a href="
${
process
.
env
.
PROTOCOL
}
://
${
process
.
env
.
HOST
}
:
${
routes
.
base
+
routes
.
confirm
process
.
env
.
PORT
}
?token=
${
token
}
">
${
process
.
env
.
HOST
}
:
${
process
.
env
.
PORT
}${
}${
routes
.
base
+
routes
.
confirm
}
?token=
${
token
}
">
${
process
.
env
.
PROTOCOL
}
://
${
process
.
env
.
HOST
}
:
${
process
.
env
.
PORT
}${
routes
.
base
+
routes
.
confirm
routes
.
base
+
routes
.
confirm
}
?token=
${
token
}
</a>`
,
}
?token=
${
token
}
</a>`
,
};
};
...
@@ -36,15 +38,9 @@ const postMail = async (email, token) => {
...
@@ -36,15 +38,9 @@ const postMail = async (email, token) => {
try
{
try
{
const
mailResult
=
await
transporter
.
sendMail
(
mailOptions
);
const
mailResult
=
await
transporter
.
sendMail
(
mailOptions
);
console
.
log
(
`Mail sent - ID :
${
mailResult
.
messageId
}
`
);
console
.
log
(
`Mail sent - ID :
${
mailResult
.
messageId
}
`
);
res
.
status
(
statusCode
.
ok
)
.
json
({
msg
:
serverMSG
.
server_ok
,
content
:
mailResult
.
response
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
"
Mail Sending Failuer.
"
);
console
.
log
(
"
Mail Sending Failuer.
"
);
console
.
log
(
err
);
console
.
log
(
err
);
res
.
status
(
statusCode
.
err
)
.
json
({
msg
:
serverMSG
.
server_err
,
content
:
err
});
}
}
};
};
...
@@ -64,12 +60,12 @@ export const postSignup = async (req, res) => {
...
@@ -64,12 +60,12 @@ export const postSignup = async (req, res) => {
body
:
{
email
,
nick_name
},
body
:
{
email
,
nick_name
},
}
=
req
;
}
=
req
;
const
result
=
db
.
User
.
findOne
({
const
result
=
await
db
.
User
.
findOne
({
where
:
{
email
:
email
},
where
:
{
email
:
email
},
logging
:
false
,
logging
:
false
,
});
});
if
(
result
.
length
!=
0
)
{
if
(
result
)
{
res
.
status
(
statusCode
.
err
).
json
({
res
.
status
(
statusCode
.
err
).
json
({
msg
:
serverMSG
.
server_err
,
msg
:
serverMSG
.
server_err
,
content
:
"
You are aleady registered
"
,
content
:
"
You are aleady registered
"
,
...
@@ -84,22 +80,22 @@ export const postSignup = async (req, res) => {
...
@@ -84,22 +80,22 @@ export const postSignup = async (req, res) => {
}
}
};
};
export
const
postLogin
=
(
req
,
res
)
=>
{
export
const
postLogin
=
async
(
req
,
res
)
=>
{
const
{
const
{
body
:
{
email
},
body
:
{
email
},
}
=
req
;
}
=
req
;
const
result
=
db
.
User
.
findAll
({
const
result
=
await
db
.
User
.
findAll
({
where
:
{
email
:
email
},
where
:
{
email
:
email
},
logging
:
false
,
logging
:
false
,
});
});
if
(
result
.
length
!=
0
)
{
if
(
result
)
{
// token 발행
// token 발행
const
mail_token
=
jwt
.
sign
(
const
mail_token
=
jwt
.
sign
(
{
{
email
:
email
,
email
:
email
,
nick_name
:
resu
t
l
[
0
][
"
nick_name
"
],
nick_name
:
resul
t
[
0
][
"
nick_name
"
],
},
},
process
.
env
.
AUTH_SECRETKEY
,
process
.
env
.
AUTH_SECRETKEY
,
{
{
...
@@ -125,8 +121,11 @@ export const postLogin = (req, res) => {
...
@@ -125,8 +121,11 @@ export const postLogin = (req, res) => {
export
const
getConfirm
=
(
req
,
res
)
=>
{
export
const
getConfirm
=
(
req
,
res
)
=>
{
const
{
const
{
params
:
{
token
},
query
:
{
token
},
}
=
req
;
}
=
req
;
console
.
log
(
`Hi, test token :
${
token
}
`
);
console
.
log
(
`Hi, test token :
${
token
}
`
);
res
.
status
(
statusCode
.
ok
)
.
json
({
msg
:
serverMSG
.
server_ok
,
content
:
`Your token is :
${
token
}
`
});
};
};
server/src/models/user.js
View file @
c0a4250c
...
@@ -23,10 +23,6 @@ export class User extends Model {
...
@@ -23,10 +23,6 @@ export class User extends Model {
allowNull
:
false
,
allowNull
:
false
,
unique
:
true
,
unique
:
true
,
},
},
password
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
false
,
},
},
},
{
{
sequelize
,
sequelize
,
...
...
server/src/views/login.pug
View file @
c0a4250c
block content
block content
.login-form_container
.login-form_container
form(action=routes.login, method="post")
form(action=
routes.base +
routes.login, method="post")
input(type="email", name="email", require=true, placeholder="E-mail")
input(type="email", name="email", require=true, placeholder="E-mail")
input(type="submit", value="Submit")
input(type="submit", value="Submit")
\ No newline at end of file
server/src/views/signup.pug
View file @
c0a4250c
block content
block content
.signup-form_container
.signup-form_container
form(action = routes.signup, method = "post")
form(action =
routes.base +
routes.signup, method = "post")
input(type="email", name="email", require=true, placeholder="E-mail")
input(type="email", name="email", require=true, placeholder="E-mail")
input(type="
number
", name="
locCod
e")
input(type="
text
", name="
nick_nam
e")
input(type="submit", value="Submit")
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