cleaned up class dependancies, moving auth to new methodology

pull/20/head
Ro 5 years ago
parent dac1193a78
commit 12d19bc3e9

1
.gitignore vendored

@ -9,6 +9,7 @@ config.development.json
*.swp
/config.json
config/config.json
config/folks.json
brain/models/_backup/
/_maintenance/
*.DS_Store

@ -11,7 +11,7 @@ var theme = 'default-dark';
var app = express();
//var request = require('request');
// view engine setup
app.set('views', path.join(__dirname, '../themes'));
app.set('views', path.join(__dirname, '../content/themes'));
app.set('view engine', 'pug');
app.use(logger('dev'));

@ -1,9 +1,19 @@
const express = require('express');
const router = express.Router();
const settings = require('../../../config/site-settings.json');
//--------------------------
// Index
//--------------------------
router.get('/', function(req, res) {});
router.get('/', function(req, res) {
let loggedIn = false;
if (req.session.user) loggedIn = true;
res.render(settings.admin_theme + '/index', {
title: settings.title,
auth_status: loggedIn
});
});
//--------------------------
// Logout

@ -1,5 +1,5 @@
'use strict';
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../utilities/DataUtils';
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../tools/DataUtils';
import Dexie from 'dexie';
import * as DataEvent from '../events/DataEvent';
export var COUNT;

@ -112,6 +112,27 @@ class DataUtils extends EventEmitter {
);
});
}
/**
* Create a function to convert the serialize and convert the form data to JSON
* @param : $('#form_example');
* @return a JSON Stringify
*/
formDataToJSON(form) {
let object = {};
let formData = new FormData(form);
formData.forEach((value, key) => {
if (!object.hasOwnProperty(key)) {
object[key] = value;
return;
}
if (!Array.isArray(object[key])) {
object[key] = [object[key]];
}
object[key].push(value);
});
let json = JSON.stringify(object);
return json;
}
//--------------------------
// event handlers
//--------------------------

@ -1,5 +1,5 @@
import * as DataEvent from '../events/DataEvent';
import DateUtils from '../utilities/DateUtils';
import DateUtils from '../tools/DateUtils';
import { position } from 'caret-pos';
import EventEmitter from '../events/EventEmitter';
import * as EditorEvent from '../events/EditorEvent';

@ -12,7 +12,7 @@
"debug": "nodemon inspect -r esm init.js --ignore node_modules/ -e js",
"watch-front": "stylus -w -m -o themes/$npm_package_theme/assets/css themes/$npm_package_theme/src/styles/base.styl & parcel watch themes/$npm_package_theme/src/com/Start.js --out-dir themes/$npm_package_theme/assets/js --out-file start.min.js --public-url /$npm_package_theme/assets/js",
"build-front-kit": "uglifyjs node_modules/scramble-text/dist/ScrambleText.min.js node_modules/animejs/anime.min.js node_modules/reframe.js/dist/reframe.min.js -c -o themes/$npm_package_theme/assets/js/toolkit.min.js",
"watch-back": "stylus -w -m -o themes/dash/assets/css themes/dash/src/styles/dash.styl & parcel watch themes/dash/src/com/Start.js --out-dir themes/dash/assets/js --out-file dash.min.js --public-url /dash/assets/js",
"watch-back": "stylus -w -m -o public/assets/css content/themes/dash/src/styles/dash.styl & parcel watch content/themes/dash/src/com/Start.js --out-dir public/assets/scripts --out-file dash.min.js --public-url /assets/scripts",
"build-back-kit": "uglifyjs themes/dash/src/libraries/highlight.pack.js node_modules/sortablejs/Sortable.min.js node_modules/scramble-text/dist/ScrambleText.min.js node_modules/animejs/anime.min.js node_modules/reframe.js/dist/reframe.min.js -c -o themes/dash/assets/js/dashkit.min.js"
},
"engines": {

Loading…
Cancel
Save