Commit 0e979e43 authored by Kim, Subin's avatar Kim, Subin
Browse files

Merge remote-tracking branch 'origin/NewMaster' into kimpen

parents 7393930d 32dcbf22
......@@ -44,4 +44,4 @@ app.use(function(err, req, res, next) {
// res.render('error');
});
module.exports = app;
\ No newline at end of file
module.exports = app;
This diff is collapsed.
......@@ -24,6 +24,7 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:3030",
"eslintConfig": {
"extends": "react-app"
},
......@@ -38,6 +39,5 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"proxy": "http://localhost:3030"
}
}
......@@ -26,18 +26,6 @@ ReactDOM.render(
document.getElementById('root')
);
// ReactDOM.render(
// <Router>
// <Switch>
// <Route exact path="/" component={Login} />
// <Route path="/home" component={Home} />
// </Switch>
// </Router>,
// document.getElementById('root')
// );
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
......
......@@ -26,4 +26,4 @@ module.exports = () => {
require('./user');
require('./reserve');
};
\ No newline at end of file
};
......@@ -31,4 +31,4 @@ const reserveSchema = new Schema({
}
});
module.exports = mongoose.model('Reserve', reserveSchema);
\ No newline at end of file
module.exports = mongoose.model('Reserve', reserveSchema);
const mongoose = require('mongoose');
const bcrypt = require("bcrypt");
const saltRounds = 10;
const { Schema } = mongoose;
const userSchema = new Schema({
id : {
type: Number,
unique: true,
},
password : {
name: {
type: String,
required: true,
},
name : {
password: {
type: String,
}
},
id: {
type: Number,
required: true,
},
});
userSchema.pre("save", function (next) {
let user = this; //User모델 자체를 가르킴.
//model 안의 paswsword가 변경 또는 생성될 때 암호화
if (user.isModified("password")) {
bcrypt.genSalt(saltRounds, function (err, salt) {
if (err) return next(err);
bcrypt.hash(user.password, salt, function (err, hash) {
if (err) return next(err);
user.password = hash;
next();
});
});
} else {
next();
}
});
module.exports = mongoose.model('User', userSchema);
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment