Commit 5fca2db9 by Fernando Martínez Santiago

Merge branch 'develop' of http://scm.ujaen.es/softuno/pictogram into develop

parents d50d976a 812f0a28
......@@ -62,18 +62,18 @@ module.exports = {
student.isStudent = true;
if (!student.license || !student.license[0]) {
sails.log.error(`Tried to login with non valid license ${req.body.username}`);
} else
res.unauthorized("Student has an invalid license");
} else {
var hasExpired = student.license[0].hasExpired();
student = student.toObject(); // to enable overwrite license field
student.license = student.license[0];
if (student.license[0].hasExpired())
student.license.expired = true;
else
student.license.expired = false;
student.license.expired = hasExpired;
return res.ok({
user: student,
token: sailsTokenAuth.issueToken(student, sails.config.jwt.expiresInMinutes),
server_time: (new Date()).getTime()
});
}
} else {
sails.log.error(`Invalid student login: user ${student.username}, password\
"${req.body.password}"`);
......@@ -84,8 +84,8 @@ module.exports = {
res.notFound("Student not found");
}
})
.catch(function () {
sails.log.error(`Error getting student ${req.body.username} for login`);
.catch(function (err) {
sails.log.error(`Error getting student ${req.body.username} for login: ` + err);
res.serverError("Error when connecting to database");
});
},
......
......@@ -99,6 +99,7 @@
"error_fetching_students": "Error when loading students",
"error_only_support_images": "Only images are supported (JPG, PNG or GIF files)",
"error_on_request": "The request has not been processed. Please, check your fields",
"error_on_request_sup_not_found": "Account not found or it has not been activated",
"error_loading_pictos": "Error loading pictos information",
"error_general": "An error has been produced",
"expand_navigation": "Expand navigation",
......
......@@ -102,6 +102,7 @@
"error_fetching_students": "Error al cargar estudiantes",
"error_only_support_images": "Sólo se soportan imágenes (ficheros JPG, PNG o GIF)",
"error_on_request": "Se ha producido un error. Por favor, compruebe los valores introducidos.",
"error_on_request_sup_not_found": "La cuenta no existe o no ha sido activada",
"error_loading_pictos": "Error cargando información de los pictos",
"error_general": "Se ha producido un error",
"February": "Febrero",
......
......@@ -49,7 +49,12 @@ dashboardControllers.controller('LoginSettingPasswordCtrl', function LoginSettin
})
.error(function(data, status, headers, config) {
$scope.reset();
ngToast.danger({ content: $translate.instant('error_on_request') });
console.log(data);
console.log(data.search("not found"));
if (data.search("not found") > 0)
ngToast.danger({ content: $translate.instant('error_on_request_sup_not_found') });
else
ngToast.danger({ content: $translate.instant('error_on_request') });
});
}
};
......
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