Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
festivelo_backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Festivelo
festivelo_backend
Commits
4b26d47a
Commit
4b26d47a
authored
5 months ago
by
Jinyeong Kim
Browse files
Options
Downloads
Patches
Plain Diff
remove annotation
parent
377ae3ff
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app.js
+2
-55
2 additions, 55 deletions
app.js
controllers/userManagementController.js
+0
-5
0 additions, 5 deletions
controllers/userManagementController.js
models/trips.js
+0
-12
0 additions, 12 deletions
models/trips.js
with
2 additions
and
72 deletions
app.js
+
2
−
55
View file @
4b26d47a
...
...
@@ -58,38 +58,12 @@ mongoose
})
.
catch
((
err
)
=>
console
.
error
(
err
));
// 세션 설정
// app.use(session({
// secret: 'your_secret_key',
// resave: false,
// saveUninitialized: false,
// }));
// Passport 초기화
//app.use(passport.initialize());
//app.use(passport.session());
// Google 로그인 라우트
app
.
get
(
'
/googlelogin
'
,
passport
.
authenticate
(
'
google
'
,
{
scope
:
[
'
profile
'
,
'
email
'
],
session
:
false
})
);
//세션 로그인--------------------------------------
// app.get('/googlelogin/redirect',
// passport.authenticate('google', { failureRedirect: '/' }),
// (req, res) => {
// const userInfo = encodeURIComponent(JSON.stringify({
// _id: req.user._id,
// email: req.user.email,
// name: req.user.name
// }));
// // 로그인 성공 시 리다이렉트
// res.redirect(`http://localhost:3000/login?user=${userInfo}`);
// console.log(`구글 로그인 성공: ${userInfo}`);
// }
// );
//----------------------------------------------
//jwt-----------------------------------------
app
.
get
(
'
/googlelogin/redirect
'
,
...
...
@@ -120,11 +94,7 @@ app.get('/googlelogin/redirect',
// 로그아웃
app
.
get
(
'
/logout
'
,
(
req
,
res
)
=>
{
//세션 로그인
// req.logout((err) => {
// if (err) { return next(err); }
// res.redirect('/');
// });
res
.
clearCookie
(
'
token
'
);
res
.
redirect
(
'
/
'
);
});
...
...
@@ -132,8 +102,7 @@ app.get('/logout', (req, res) => {
// 대시보드
app
.
get
(
'
/dashboard
'
,
authenticateToken
,
(
req
,
res
)
=>
{
//세션 로그인
//const hasPassword = !!req.user.password; // 비밀번호가 있는지 확인
//const userName = req.user.name || req.user.email || 'Guest';
res
.
send
(
`
<h1>Welcome,
${
userName
}
}</h1>
...
...
@@ -145,13 +114,7 @@ app.get('/dashboard', authenticateToken, (req, res) => {
`
);
});
//session
// app.get('/conf_password', (req, res) => {
// if (req.isAuthenticated && req.isAuthenticated()) { // 로그인 여부 확인
// res.sendFile(__dirname + '/public/conf_password.html');
// }
// });
//jwt
app
.
get
(
'
/conf_password
'
,
authenticateToken
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'
/public/conf_password.html
'
);
...
...
@@ -184,19 +147,6 @@ app.post('/login', async (req, res) => {
return
res
.
status
(
400
).
json
({
message
:
'
비밀번호가 일치하지 않습니다.
'
});
}
// 로그인 성공 시 사용자 세션에 저장 - 세션 로그인
// req.login(user, (err) => {
// if (err) {
// console.error('로그인 세션 저장 오류:', err);
// return res.status(500).json({ message: '로그인 세션 저장 중 오류가 발생했습니다.' });
// }
// res.status(200).json({ message: '로그인 성공', user: {
// _id: user._id,
// email: user.email,
// name: user.name
// } });
// console.log('로그인 성공: ', user);
//jwt---------------------------------------
const
token
=
jwt
.
sign
(
{
userId
:
user
.
_id
,
email
:
user
.
email
,
name
:
user
.
name
},
...
...
@@ -243,9 +193,6 @@ app.post('/signup', async (req, res) => {
});
await
user
.
save
();
// if((!user.password)||(!user.email)||(!user.name)){
// res.status(500).json({ message: '요청 정보가 누락되었습니다.'});
// }
res
.
status
(
201
).
json
({
message
:
'
회원가입 성공
'
});
}
catch
(
error
)
{
...
...
This diff is collapsed.
Click to expand it.
controllers/userManagementController.js
+
0
−
5
View file @
4b26d47a
...
...
@@ -7,11 +7,6 @@ const path = require('path'); // 경로 처리 모듈 추가
const
router
=
express
.
Router
();
// router.get('/change', (req, res) => {
// // 닉네임 변경 HTML 파일 반환
// res.sendFile(path.join(__dirname, '../public/conf_name.html')); // HTML 파일 경로 설정
// });
//사용자 이름 변경(닉네임)
exports
.
changeName
=
async
(
req
,
res
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
models/trips.js
+
0
−
12
View file @
4b26d47a
const
mongoose
=
require
(
'
mongoose
'
);
const
User
=
require
(
'
./user
'
);
// user.js 참조
// //장소 서브스키마
// const placeSchema = new mongoose.Schema({
// id: { type: Number, required: true },
// type: {type: Number, required: true},
// name: { type: String, required: true }, // 여행지 이름
// address: { type: String, required: true }, // 장소
// //좌표
// coordinates: {
// lat: { type: Number, required: true },
// lng: { type: Number, required: true }
// }
// });
// 하루 계획 스키마 정의( day1, day2...)
const
daySchema
=
new
mongoose
.
Schema
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment