app.post('/login', function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
console.log("USER FROM LOGIN:", user);
if (err) { return next(err); }
if (!user) { return res.redirect('/login'); }
req.logIn(user, function(err) {
if (err) {
console.log('USER PROBLEM');
return next(err);
}
console.log("USER NO PROBLEM");
return res.redirect('/users/' + user.username);
});
})(req, res, next);
});
let User = sequelize.define('users', {
username: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
validate: { notEmpty: { msg: "username is required" } }
},
password: {
type: Sequelize.STRING,
allowNull: false,
validate: { notEmpty: { msg: "password is required" } }
}
});
User.validPassword = (plainTextPassword, hash, user, done) => {
return bcrypt.compare(plainTextPassword, hash);
}
User.beforeCreate((user, options) => {
return bcrypt.hash(user.password, 12).then(hash => {
user.password = hash;
});
});
app.post('/login', passport.authenticate('local', {
successRedirect: '/',
failureRedirect: '/user',
failureFlash: true
}));
написать запросы на стороне сервера, а через программу делать запросы на него и таким образом добавлять новую информацию и файлы
invoke glBegin,GL_POLYGON
invoke glNormal3f p4(0, 0.549941, -1.904258)
invoke glColor3f p4(1.0,0.0,0.0)
invoke glVertex3f p4(0, 0, 0)
invoke glNormal3f p4(0.038275, 0.549941, -1.904258)
invoke glColor3f p4(0.0,1.0,0.0)
invoke glVertex3f p4(1.0, 0, 0)
invoke glNormal3f p4(0.07655, 0.549941, -1.904258)
invoke glColor3f p4(0.0,1.0,1.0)
invoke glVertex3f p4(0, 1.0, 0)
invoke glNormal3f p4(0.114825, 0.549941, -1.904258)
invoke glColor3f p4(0.0,0.0,1.0)
invoke glVertex3f p4(1.0, 1.0, 0)
invoke glEnd
v 0.024808 0.478133 -1.861193
v 0.024997 0.478523 -1.862418
v 0.023856 0.470473 -1.856831
v 0.024096 0.472943 -1.857624
v 0.024101 0.474244 -1.859385
v 0.023831 0.472143 -1.858831
vt 0 0 0
vt 1 0 0
vt 0 1 0
vt 1 1 0
vt 0 1 0