issues #213 #238 and #240 fixed

parent 297f8a63
......@@ -479,10 +479,10 @@ module.exports = {
.then(function (supervisor) {
if (!supervisor)
return res.notFound();
delete supervisor.password;
if (req.body.password && req.body.password.length > 0)
supervisor.password = req.body.password;
else
delete supervisor.password;
console.log(supervisor.password);
supervisor.name = req.body.name || supervisor.name;
supervisor.surname = req.body.surname || supervisor.surname;
supervisor.gender = req.body.gender || supervisor.gender;
......@@ -739,9 +739,13 @@ module.exports = {
delete: function (req, res) {
if (!req.params.id)
return res.badRequest("Missing parameter");
StuSup.destroy({id_sup: req.params.id})
.then(() => {
Supervisor.destroy({id: req.params.id})
.then(() => {res.ok()})
.catch((err) => {res.serverError("Could not delete supervisor")});
.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 = {
Supervisor.findOne({ email: attrs.email }).then(function (supervisor) {
if (supervisor && supervisor.id !== attrs.id) {
cb(new Error('Email being used'));
} else if (attrs.password && attrs.password.length > 0 && attrs.password == supervisor.password) {
delete attrs.password;
cb();
} else {
cb();
}
......@@ -203,8 +206,9 @@ module.exports = {
var bcrypt = require('bcrypt-nodejs');
if (attrs.password && attrs.password.length > 0) {
attrs.password = bcrypt.hashSync(attrs.password, bcrypt.genSaltSync());
} else
} else {
delete attrs.password;
}
cb();
}
],
......
......@@ -697,6 +697,14 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$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
$scope.showActiveScene();
$scope.loadScenesList();
......
......@@ -56,7 +56,7 @@
<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-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>
......
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