Commit 57ddadcb authored by antoine masson's avatar antoine masson
Browse files

v1.11

-Add error message when poc is not defined
parent 99c22636
......@@ -530,6 +530,11 @@ exports.getSurveyInfo= async (req, res) => {
try {
const survey = await Survey.findById(req.userData.survey_id);
const poc = await survey.poc
if (!poc) {
return res
.status(400)
.json({ message: "Contact user is not defined" ,status: "Error"});
}
let surveygeneral = survey.general;
let languages = []
......
......@@ -180,7 +180,11 @@ exports.loginToken = async (req, res) => {
try {
const token = await Token.findOne({ token:req.body.token });
const gopt = await GlobalOptions.findById(0,{poc:1});
if (!gopt) {
return res
.status(400)
.json({ message: "Global user is not defined" ,status: "Error"});
}
if (!token) {
return res
.status(201)
......@@ -221,6 +225,11 @@ exports.accessToken = async (req, res) => {
try{
const survey = await Survey.findById(req.body.survey_id)
let spoc= await survey.poc
if (!spoc) {
return res
.status(400)
.json({ message: "Global user is not defined" ,status: "Error"});
}
let token = await Token.findOne({ token:req.body.token });
if(!survey.status && (!token || !token.test)){
return res
......
{
"name": "api",
"version": "1.1.0",
"version": "1.1.1",
"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