Skip to content

Commit

Permalink
changed back routes for saveUserImageBase64
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonGodefroid committed Jun 5, 2017
1 parent 1cf1651 commit d602d8d
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 110 deletions.
15 changes: 8 additions & 7 deletions models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ var UserSchema = new mongoose.Schema({
}
],
moviesSwiperDeck: Array
}
},
cId: String
});

UserSchema.plugin(passportLocalMongoose, {
Expand All @@ -114,10 +115,10 @@ UserSchema.plugin(passportLocalMongoose, {
});

// Cette méthode sera utilisée par la strategie `passport-local` pour trouver un utilisateur en fonction de son `email` et `password`
UserSchema.statics.authenticateLocal = function() {
UserSchema.statics.authenticateLocal = function () {
var _self = this;
return function(req, email, password, cb) {
_self.findByUsername(email, true, function(err, user) {
return function (req, email, password, cb) {
_self.findByUsername(email, true, function (err, user) {
if (err) return cb(err);
if (user) {
return user.authenticate(password, cb);
Expand All @@ -129,17 +130,17 @@ UserSchema.statics.authenticateLocal = function() {
};

// Cette méthode sera utilisée par la strategie `passport-http-bearer` pour trouver un utilisateur en fonction de son `token`
UserSchema.statics.authenticateBearer = function() {
UserSchema.statics.authenticateBearer = function () {
var _self = this;
return function(token, cb) {
return function (token, cb) {
if (!token) {
cb(null, false);
} else {
_self.findOne(
{
token: token
},
function(err, user) {
function (err, user) {
if (err) return cb(err);
if (!user) return cb(null, false);
return cb(null, user);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "node server.js",
"local": "concurrently nodemon server.js",
"local": "nodemon server.js",
"dev": "nodemon server.js",
"chat": "nodemon serverMessages.js",
"importData": "node data/importAllocineNowShowingMovies.js && node data/importAllocineComingSoonMovies.js && node data/importUsers.js",
Expand Down
Loading

0 comments on commit d602d8d

Please sign in to comment.