issues #213 #238 and #240 fixed

parent 297f8a63
...@@ -479,10 +479,10 @@ module.exports = { ...@@ -479,10 +479,10 @@ module.exports = {
.then(function (supervisor) { .then(function (supervisor) {
if (!supervisor) if (!supervisor)
return res.notFound(); return res.notFound();
delete supervisor.password;
if (req.body.password && req.body.password.length > 0) if (req.body.password && req.body.password.length > 0)
supervisor.password = req.body.password; supervisor.password = req.body.password;
else console.log(supervisor.password);
delete supervisor.password;
supervisor.name = req.body.name || supervisor.name; supervisor.name = req.body.name || supervisor.name;
supervisor.surname = req.body.surname || supervisor.surname; supervisor.surname = req.body.surname || supervisor.surname;
supervisor.gender = req.body.gender || supervisor.gender; supervisor.gender = req.body.gender || supervisor.gender;
...@@ -739,9 +739,13 @@ module.exports = { ...@@ -739,9 +739,13 @@ module.exports = {
delete: function (req, res) { delete: function (req, res) {
if (!req.params.id) if (!req.params.id)
return res.badRequest("Missing parameter"); return res.badRequest("Missing parameter");
Supervisor.destroy({id: req.params.id}) StuSup.destroy({id_sup: req.params.id})
.then(() => {res.ok()}) .then(() => {
.catch((err) => {res.serverError("Could not delete supervisor")}); Supervisor.destroy({id: req.params.id})
.then(() => {res.ok()})
.catch((err) => {console.log(err); res.serverError("Could not delete supervisor")});
})
.catch((err) => {console.log(err); res.serverError("Could not delete supervisor")});
} }
}; };
...@@ -190,6 +190,9 @@ module.exports = { ...@@ -190,6 +190,9 @@ module.exports = {
Supervisor.findOne({ email: attrs.email }).then(function (supervisor) { Supervisor.findOne({ email: attrs.email }).then(function (supervisor) {
if (supervisor && supervisor.id !== attrs.id) { if (supervisor && supervisor.id !== attrs.id) {
cb(new Error('Email being used')); cb(new Error('Email being used'));
} else if (attrs.password && attrs.password.length > 0 && attrs.password == supervisor.password) {
delete attrs.password;
cb();
} else { } else {
cb(); cb();
} }
...@@ -203,8 +206,9 @@ module.exports = { ...@@ -203,8 +206,9 @@ module.exports = {
var bcrypt = require('bcrypt-nodejs'); var bcrypt = require('bcrypt-nodejs');
if (attrs.password && attrs.password.length > 0) { if (attrs.password && attrs.password.length > 0) {
attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync()); attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync());
} else } else {
delete attrs.password; delete attrs.password;
}
cb(); cb();
} }
], ],
......
...@@ -697,6 +697,14 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -697,6 +697,14 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope.$apply(); $scope.$apply();
}); });
// unsubscribe sockets when leaving
$rootScope.$on('$stateChangeStart',
function(event, toState, toParams, fromState, fromParams) {
io.socket.off('scene');
io.socket.off('vocabulary');
}
);
// Load pictos // Load pictos
$scope.showActiveScene(); $scope.showActiveScene();
$scope.loadScenesList(); $scope.loadScenesList();
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="row"> <div class="row">
<div class="col-xs-2"><i class="fa fa-info-circle fa-lg" aria-hidden="true"></i></div> <div class="col-xs-2"><i class="fa fa-info-circle fa-lg" aria-hidden="true"></i></div>
<div class="col-xs-10"> <div class="col-xs-10">
<h4 class="alert-heading"> {{ 'license_expires' | translate }} <b>{{ studentData.expiration_date }}</b> </h4> {{ 'license_expires' | translate }} <b>{{ studentData.expiration_date }}</b>
</div> </div>
</div> </div>
</div> </div>
......
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 sign in to comment