mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-25 16:19:44 +02:00
Authentication (#22)
* Authorization added * added secret to password, md5 hashing, removed promise from verifyToken, deleted links when not authorized * added dbinsert script * turned verifyToken to middleware, added description for dbinsert, added hidden csrf field in auth form * added middlewares, user model and controller * JSDoc fix * wrong password processing fix * added comments to dbinsert script, moved salt and passHash to singe db doc * Moved salt to .env, upgradedscript for generating password was, fixed comments and JSDoc * Deleted using salt (now user is only one), changed verifying password to bcrypt.compare, added httpyOnly property to jwt cookie
This commit is contained in:
parent
718be6d2f6
commit
58d3892d8f
33 changed files with 1464 additions and 58 deletions
|
@ -2,6 +2,7 @@ import hljs from 'highlight.js/lib/highlight';
|
|||
import javascript from 'highlight.js/lib/languages/javascript';
|
||||
import xml from 'highlight.js/lib/languages/xml';
|
||||
import json from 'highlight.js/lib/languages/json';
|
||||
// eslint-disable-next-line
|
||||
import style from 'highlight.js/styles/atom-one-dark.css';
|
||||
|
||||
/**
|
||||
|
@ -13,7 +14,7 @@ export default class CodeStyler {
|
|||
* @param {string} selector - CSS selector for code blocks
|
||||
* @param {string[]} languages - list of languages to highlight, see hljs.listLanguages()
|
||||
*/
|
||||
constructor({selector, languages = [ 'javascript', 'xml', 'json' ]}) {
|
||||
constructor({ selector, languages = ['javascript', 'xml', 'json'] }) {
|
||||
this.codeBlocksSelector = selector;
|
||||
this.languages = languages;
|
||||
this.langsAvailable = {
|
||||
|
|
|
@ -11,7 +11,6 @@ import Delimiter from 'codex.editor.delimiter';
|
|||
import InlineCode from 'codex.editor.inline-code';
|
||||
import List from 'codex.editor.list';
|
||||
import RawTool from 'codex.editor.raw';
|
||||
import ImageTool from 'codex.editor.image';
|
||||
import Embed from 'codex.editor.embed';
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class Writing {
|
|||
* Init code highlighting
|
||||
*/
|
||||
async createCodeStyling() {
|
||||
const {default: CodeStyler} = await import(/* webpackChunkName: "code-styling" */ './../classes/codeStyler');
|
||||
const { default: CodeStyler } = await import(/* webpackChunkName: "code-styling" */ './../classes/codeStyler');
|
||||
|
||||
return new CodeStyler({
|
||||
selector: '.block-code'
|
||||
|
|
|
@ -64,7 +64,8 @@ export default class Writing {
|
|||
|
||||
if (this.nodes.removeButton) {
|
||||
this.nodes.removeButton.addEventListener('click', () => {
|
||||
const isUserAgree = confirm("Are you sure?");
|
||||
const isUserAgree = window.confirm('Are you sure?');
|
||||
|
||||
if (!isUserAgree) {
|
||||
return;
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ export default class Writing {
|
|||
* @return {Promise<Editor>}
|
||||
*/
|
||||
async loadEditor() {
|
||||
const {default: Editor} = await import(/* webpackChunkName: "editor" */ './../classes/editor');
|
||||
const { default: Editor } = await import(/* webpackChunkName: "editor" */ './../classes/editor');
|
||||
|
||||
const editorConfig = this.page ? {
|
||||
data: this.page.body
|
||||
|
@ -119,6 +120,7 @@ export default class Writing {
|
|||
|
||||
/** get ordering selector value */
|
||||
let putAbovePageId = null;
|
||||
|
||||
if (this.nodes.putAboveIdSelector) {
|
||||
putAbovePageId = this.nodes.putAboveIdSelector.value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue