From 88957d98a18a8ecad96cc280a7598af5bde7bfc5 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 13 Dec 2016 12:47:09 -0400 Subject: [PATCH] Production fixes --- app/app.js | 2 +- app/index.html | 6 +++--- .../professor/professor_create.controller.js | 4 ++-- app/server.js | 18 ++++++++++-------- package.json | 2 ++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/app.js b/app/app.js index 4953375..26001fc 100644 --- a/app/app.js +++ b/app/app.js @@ -44,7 +44,7 @@ }) .run(function ($rootScope) { - $rootScope.domainUrl = 'Localhost:3000'; + $rootScope.domainUrl = '190.169.74.203:3000'; }); })(); diff --git a/app/index.html b/app/index.html index 607e1ce..051f34e 100644 --- a/app/index.html +++ b/app/index.html @@ -39,9 +39,9 @@ - - - + + + diff --git a/app/partials/professor/professor_create.controller.js b/app/partials/professor/professor_create.controller.js index f99b549..2d10ec7 100644 --- a/app/partials/professor/professor_create.controller.js +++ b/app/partials/professor/professor_create.controller.js @@ -21,7 +21,7 @@ "lastname": vm.profesor.Apellido, "email": vm.profesor.Correo, "number": vm.profesor.Telefono, - "role": "professor", + "role": "admin", "password": vm.profesor.Password }; @@ -65,4 +65,4 @@ $state.go('ProfessorList'); }; }; -})(); \ No newline at end of file +})(); diff --git a/app/server.js b/app/server.js index a4959ae..a49f0fa 100644 --- a/app/server.js +++ b/app/server.js @@ -16,6 +16,7 @@ var auth = jwt({ secret: 'MY_SECRET', userProperty: 'payload' }); +mongoose.Promise = require('bluebird'); app.use(express.static(__dirname)); app.use(bodyParser.json()); @@ -160,7 +161,7 @@ db.once('open', function() { app.post('/professors', function(req, res){ console.log('Received ADD professor request'); - //console.log(req.body); + console.log(req.body); var professor = new Professor({ id: req.body.id, @@ -175,7 +176,7 @@ db.once('open', function() { professor.save( function(err, docs){ - // setup e-mail data with unicode symbols + /* // setup e-mail data with unicode symbols var mailOptions = { from: '"MASA Notifier" ', // sender address to: req.body.email, // list of receivers @@ -183,12 +184,12 @@ db.once('open', function() { text: 'Este es un correo automatizado para informarle que ha sido registrado en la aplicación M.A.S.A. sus credenciales son: '+ req.body.id +' / '+ req.body.password, html: 'Este es un correo automatizado para informarle que ha sido registrado en la aplicación M.A.S.A. sus credenciales son: '+ req.body.id +' / '+ req.body.password }; - // send mail with defined transport object + // send mail with defined transport object transporter.sendMail(mailOptions, function(error, info){ if(error) return console.log(error); console.log('Message sent: ' + info.response); - }); - var token = professor.generateJwt(); + });*/ + var token = professor.generateJwt(); res.status(200); res.json({"token" : token}); }) @@ -246,7 +247,8 @@ db.once('open', function() { })(req, res); }); }); - +//mongoose.Promise = global.Promise; mongoose.connect('mongodb://localhost/AttendanceDB'); -app.listen(3000); -console.log("server running on port 3000"); \ No newline at end of file +app.listen(3000, '0.0.0.0'); + +console.log("server running on port 3000"); diff --git a/package.json b/package.json index f53d59a..3125b81 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "karma": "^0.13.9" }, "dependencies": { + "bluebird": "^3.4.6", "body-parser": "latest", "cookie-parser": "^1.4.1", "express": "latest", @@ -25,6 +26,7 @@ "jsonwebtoken": "^6.2.0", "mongoose": "latest", "morgan": "^1.7.0", + "nodemailer": "^2.7.0", "passport": "^0.3.2", "passport-local": "^1.0.0", "serve-favicon": "^2.3.0"