Commit 82010fab authored by r03ert0's avatar r03ert0
Browse files

tabs into 4 spaces

parent 7c74bf13
......@@ -11,10 +11,10 @@ router.post('/json', controller.validator_post, tokenAuthentication, controller.
router.get('/upload', uploadController.token);
router.post('/upload',
multer({dest: './tmp/'}).array('atlas'),
uploadController.validator,
uploadController.other_validations,
uploadController.upload);
multer({dest: './tmp/'}).array('atlas'),
uploadController.validator,
uploadController.other_validations,
uploadController.upload);
router.get('/reset', controller.reset);
......
......@@ -20,12 +20,12 @@ const DOMPurify = createDOMPurify(window);
const validator = function (req, res, next) {
req.checkParams('projectName', 'incorrect project name').isAlphanumeric();
// Req.checkQuery('url', 'please enter a valid URL')
// .isURL();
// Req.checkQuery('url', 'please enter a valid URL')
// .isURL();
// req.checkQuery('var', 'please enter one of the variables that are indicated')
// .optional()
// .matches("localpath|filename|source|url|dim|pixdim"); //todo: decent regexp
// req.checkQuery('var', 'please enter one of the variables that are indicated')
// .optional()
// .matches("localpath|filename|source|url|dim|pixdim"); //todo: decent regexp
const errors = req.validationErrors();
if (errors) {
res.send(errors).status(403).end();
......@@ -192,9 +192,9 @@ const isProjectObject = function (req, res, object) {
* @param {Object} res Res object from express
*/
const project = function (req, res) {
const login = (req.isAuthenticated()) ?
('<a href=\'/user/' + req.user.username + '\'>' + req.user.username + '</a> (<a href=\'/logout\'>Log Out</a>)') :
('<a href=\'/auth/github\'>Log in with GitHub</a>');
const login = (req.isAuthenticated()) ?
('<a href=\'/user/' + req.user.username + '\'>' + req.user.username + '</a> (<a href=\'/logout\'>Log Out</a>)') :
('<a href=\'/auth/github\'>Log in with GitHub</a>');
let loggedUser = 'anonymous';
if (req.isAuthenticated()) {
loggedUser = req.user.username;
......@@ -207,7 +207,7 @@ const project = function (req, res) {
req.session.returnTo = req.originalUrl;
req.db.get('project').findOne({shortname: req.params.projectName, backup: {$exists: 0}}, '-_id')
.then(json => {
.then(json => {
if (json) {
// Check that the logged user has access to view this project
if (checkAccess.toProject(json, loggedUser, 'view') === false) {
......@@ -223,7 +223,7 @@ const project = function (req, res) {
login
});
} else {
res.status(404).send('Project Not Found');
res.status(404).send('Project Not Found');
}
});
};
......@@ -245,7 +245,7 @@ const api_project = function (req, res) {
}
req.db.get('project').findOne({shortname: req.params.projectName, backup: {$exists: 0}}, '-_id')
.then(json => {
.then(json => {
if (json) {
// Check that the logged user has access to view this project
if (checkAccess.toProject(json, loggedUser, 'view') === false) {
......@@ -344,7 +344,7 @@ const settings = function (req, res) {
req.session.returnTo = req.originalUrl;
req.db.get('project').findOne({shortname: req.params.projectName, backup: {$exists: 0}}, '-_id')
.then(json => {
.then(json => {
if (json) {
// Check that the logged user has access to view this project
if (checkAccess.toProject(json, loggedUser, 'view') === false) {
......@@ -352,7 +352,7 @@ const settings = function (req, res) {
return;
}
} else {
json = {
json = {
name: '',
shortname: req.params.projectName,
url: '',
......
......@@ -4,18 +4,18 @@ const checkAccess = require('../../js/checkAccess.js');
const dataSlices = require('../../js/dataSlices.js');
const validator = function (req, res, next) {
// UserName can be an ip address (for anonymous users)
// UserName can be an ip address (for anonymous users)
/*
req.checkParams('userName', 'incorrect user name').isAlphanumeric();
var errors = req.validationErrors();
console.log(errors);
if (errors) {
res.send(errors).status(403).end();
} else {
return next();
}
*/
/*
req.checkParams('userName', 'incorrect user name').isAlphanumeric();
var errors = req.validationErrors();
console.log(errors);
if (errors) {
res.send(errors).status(403).end();
} else {
return next();
}
*/
next();
};
......
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