Commit b22da084 authored by antoine masson's avatar antoine masson
Browse files

v1.10

- Fix a mistake in access fonct
parent a3e4cb72
......@@ -218,7 +218,7 @@ exports.loginToken = async (req, res) => {
};
exports.accessToken = async (req, res) => {
if(await Survey.isAccessToken(req.body.survey_id)){
// try{
try{
const survey = await Survey.findById(req.body.survey_id)
let spoc= await survey.poc
let token = await Token.findOne({ token:req.body.token });
......@@ -251,9 +251,9 @@ exports.accessToken = async (req, res) => {
}
const authtoken = await token.generateAuthToken();
res.status(201).json({ token:authtoken, message : "Succeeded Login", status: "OK"});
// } catch(err){
// res.status(400).json({ message: err,status:"Error"});
// }
} catch(err){
res.status(400).json({ message: err,status:"Error"});
}
} else {
const gopt = await GlobalOptions.findById(0,{poc:1});
res.status(400).json({ message: "Forbidden Operation",poc:gopt.poc,status:"Error"});
......@@ -317,7 +317,7 @@ exports.update_answers = async (req, res) => {
}
token.answers = req.body.answers;
await token.save();
res.status(201).json({message:"Token status modified",status: "OK"});
res.status(201).json({message:"Token answers modified",status: "OK"});
} catch (err) {
res.status(400).json({ message: err,status:"Error"});
}
......
{
"name": "api",
"version": "1.0.9",
"version": "1.1.0",
"description": "",
"main": "index.js",
"scripts": {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment