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) => { ...@@ -530,6 +530,11 @@ exports.getSurveyInfo= async (req, res) => {
try { try {
const survey = await Survey.findById(req.userData.survey_id); const survey = await Survey.findById(req.userData.survey_id);
const poc = await survey.poc 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 surveygeneral = survey.general;
let languages = [] let languages = []
......
...@@ -180,7 +180,11 @@ exports.loginToken = async (req, res) => { ...@@ -180,7 +180,11 @@ exports.loginToken = async (req, res) => {
try { try {
const token = await Token.findOne({ token:req.body.token }); const token = await Token.findOne({ token:req.body.token });
const gopt = await GlobalOptions.findById(0,{poc:1}); 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) { if (!token) {
return res return res
.status(201) .status(201)
...@@ -221,6 +225,11 @@ exports.accessToken = async (req, res) => { ...@@ -221,6 +225,11 @@ exports.accessToken = async (req, res) => {
try{ try{
const survey = await Survey.findById(req.body.survey_id) const survey = await Survey.findById(req.body.survey_id)
let spoc= await survey.poc 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 }); let token = await Token.findOne({ token:req.body.token });
if(!survey.status && (!token || !token.test)){ if(!survey.status && (!token || !token.test)){
return res return res
......
{ {
"name": "api", "name": "api",
"version": "1.1.0", "version": "1.1.1",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "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