summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.eslintrc.json2
-rw-r--r--controllers/games/gameId.js8
-rw-r--r--controllers/games/root.js22
-rw-r--r--controllers/root/login.js22
-rw-r--r--controllers/root/logout.js4
-rw-r--r--controllers/root/root.js4
-rw-r--r--database/db.js18
-rw-r--r--database/games.js8
-rw-r--r--database/users.js10
-rw-r--r--main.js22
-rw-r--r--middlewares/formParser.js2
-rw-r--r--middlewares/helmet.js4
-rw-r--r--middlewares/requireAuth.js2
-rw-r--r--middlewares/sessions.js20
-rw-r--r--routes/games.js20
-rw-r--r--routes/root.js22
-rw-r--r--tests/games.spec.js30
-rw-r--r--tests/root.spec.js44
-rw-r--r--utils/board.js30
-rw-r--r--utils/checks.js14
20 files changed, 154 insertions, 154 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index 8be50d1..4550533 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -25,7 +25,7 @@
"node/no-unpublished-import": ["error", {"allowModules": ["vitest", "supertest"]}],
"quotes": [
"error",
- "double"
+ "single"
],
"semi": [
"error",
diff --git a/controllers/games/gameId.js b/controllers/games/gameId.js
index d3363fd..9487743 100644
--- a/controllers/games/gameId.js
+++ b/controllers/games/gameId.js
@@ -1,8 +1,8 @@
-import { getGame } from "../../database/games.js";
+import { getGame } from '../../database/games.js';
function makePageData(user, game) {
return {
- title: "Jouer",
+ title: 'Jouer',
user: user,
data: game,
};
@@ -18,7 +18,7 @@ export function gameId_get(req, res) {
game.letters = game.player2.letters;
delete game.player1.letters;
}
- return res.render("game", makePageData(req.session.user, game));
+ return res.render('game', makePageData(req.session.user, game));
}
- return res.redirect("/games");
+ return res.redirect('/games');
}
diff --git a/controllers/games/root.js b/controllers/games/root.js
index 4a4e80d..8b6fc22 100644
--- a/controllers/games/root.js
+++ b/controllers/games/root.js
@@ -1,17 +1,17 @@
-import { validationResult } from "express-validator";
+import { validationResult } from 'express-validator';
-import { getUserByUsername } from "../../database/users.js";
-import { listGames, newGame } from "../../database/games.js";
-import { emptyBoard, Bag } from "../../utils/board.js";
+import { getUserByUsername } from '../../database/users.js';
+import { listGames, newGame } from '../../database/games.js';
+import { emptyBoard, Bag } from '../../utils/board.js';
function makePageData(user) {
return {
- title: "Parties",
+ title: 'Parties',
user: user,
games: listGames(user.id),
formdata: {
- name: "",
- username: "",
+ name: '',
+ username: '',
},
errors: {},
};
@@ -20,7 +20,7 @@ function makePageData(user) {
export function root_get(req, res) {
let page = makePageData(req.session.user);
page.games.forEach(g => g.data = JSON.parse(g.data));
- return res.render("games", page);
+ return res.render('games', page);
}
function makeNewGameData(name, player1, player2) {
@@ -54,11 +54,11 @@ export function root_post(req, res) {
if (gameId) {
return res.redirect(302, `/games/${gameId}`);
} else {
- page.errors.mismatch = "Erreur du serveur: la création de partie a échoué";
+ page.errors.mismatch = 'Erreur du serveur: la création de partie a échoué';
}
} else {
- page.errors.username = { msg: "L'identifiant n'existe pas." };
+ page.errors.username = { msg: 'L\'identifiant n\'existe pas.' };
}
}
- return res.render("games", page);
+ return res.render('games', page);
}
diff --git a/controllers/root/login.js b/controllers/root/login.js
index ac6a471..431f7f9 100644
--- a/controllers/root/login.js
+++ b/controllers/root/login.js
@@ -1,14 +1,14 @@
-import { validationResult } from "express-validator";
+import { validationResult } from 'express-validator';
-import { login } from "../../database/users.js";
+import { login } from '../../database/users.js';
function makePageData(user) {
return {
- title: "Connexion",
+ title: 'Connexion',
user: user,
data: {
- username: "",
- password: "",
+ username: '',
+ password: '',
},
errors: {},
};
@@ -16,14 +16,14 @@ function makePageData(user) {
export function login_get(req, res) {
if (req.session.user !== undefined) {
- return res.redirect(302, "/games");
+ return res.redirect(302, '/games');
}
- return res.render("login", makePageData(req.session.user));
+ return res.render('login', makePageData(req.session.user));
}
export async function login_post(req, res) {
if (req.session.user !== undefined) {
- return res.redirect(302, "/games");
+ return res.redirect(302, '/games');
}
let page = makePageData(req.session.user);
page.data = req.body;
@@ -33,11 +33,11 @@ export async function login_post(req, res) {
if (user !== null) {
req.session.user = user;
} else {
- page.errors.mismatch = "L'identifiant et le mot de passe ne correspondent pas, ou l'identifiant n'existe pas.";
+ page.errors.mismatch = 'L\'identifiant et le mot de passe ne correspondent pas, ou l\'identifiant n\'existe pas.';
}
}
if (Object.keys(page.errors).length === 0) {
- return res.redirect(302, "/games");
+ return res.redirect(302, '/games');
}
- return res.render("login", page);
+ return res.render('login', page);
}
diff --git a/controllers/root/logout.js b/controllers/root/logout.js
index 078df9a..d8b1b75 100644
--- a/controllers/root/logout.js
+++ b/controllers/root/logout.js
@@ -1,7 +1,7 @@
export function logout_get(req, res) {
if (req.session.user !== undefined) {
- res.clearCookie("JDMSessionId");
+ res.clearCookie('JDMSessionId');
req.session.destroy();
}
- return res.redirect(302, "/");
+ return res.redirect(302, '/');
}
diff --git a/controllers/root/root.js b/controllers/root/root.js
index 062edf4..6349983 100644
--- a/controllers/root/root.js
+++ b/controllers/root/root.js
@@ -1,6 +1,6 @@
export function root_get(req, res) {
if (req.session.user !== undefined) {
- return res.redirect(302, "/games");
+ return res.redirect(302, '/games');
}
- return res.redirect(302, "/login");
+ return res.redirect(302, '/login');
}
diff --git a/database/db.js b/database/db.js
index 1e8b50d..1d8a3f0 100644
--- a/database/db.js
+++ b/database/db.js
@@ -1,27 +1,27 @@
-import fs from "fs";
-import Database from "better-sqlite3";
+import fs from 'fs';
+import Database from 'better-sqlite3';
const allMigrations = [
- "database/000_init.sql",
- "database/001_games.sql",
+ 'database/000_init.sql',
+ 'database/001_games.sql',
];
const db = new Database(
- process.env.NODE_ENV === "test" ? "testjdm.db" : "jdm.db",
- process.env.NODE_ENV === "development" ? { verbose: console.log } : null
+ process.env.NODE_ENV === 'test' ? 'testjdm.db' : 'jdm.db',
+ process.env.NODE_ENV === 'development' ? { verbose: console.log } : null
);
-db.pragma("foreign_keys = ON");
+db.pragma('foreign_keys = ON');
db.transaction(function migrate() {
let version;
try {
- version = db.prepare("SELECT version FROM schema_version").get().version;
+ version = db.prepare('SELECT version FROM schema_version').get().version;
} catch {
version = 0;
}
if (version === allMigrations.length) return;
while (version < allMigrations.length) {
- db.exec(fs.readFileSync(allMigrations[version], "utf8"));
+ db.exec(fs.readFileSync(allMigrations[version], 'utf8'));
version++;
}
db.exec(`DELETE FROM schema_version; INSERT INTO schema_version (version) VALUES (${version});`);
diff --git a/database/games.js b/database/games.js
index 3517d0a..ac9a4ad 100644
--- a/database/games.js
+++ b/database/games.js
@@ -1,8 +1,8 @@
-import db from "./db.js";
+import db from './db.js';
-const getGameStatement = db.prepare("SELECT * from games where id = ?;");
-const listGamesStatement = db.prepare("SELECT * from games where player1 = ?1 OR player2 = ?1 ORDER BY last_move_at;");
-const newGameStatement = db.prepare("INSERT INTO games (player1, player2, data) VALUES (?, ?, ?);");
+const getGameStatement = db.prepare('SELECT * from games where id = ?;');
+const listGamesStatement = db.prepare('SELECT * from games where player1 = ?1 OR player2 = ?1 ORDER BY last_move_at;');
+const newGameStatement = db.prepare('INSERT INTO games (player1, player2, data) VALUES (?, ?, ?);');
export function getGame(id) {
try {
diff --git a/database/users.js b/database/users.js
index b24e3b4..cc50bdc 100644
--- a/database/users.js
+++ b/database/users.js
@@ -1,12 +1,12 @@
-import bcrypt from "bcrypt";
+import bcrypt from 'bcrypt';
-import db from "./db.js";
+import db from './db.js';
const saltRounds = 10;
-const createUserStatement = db.prepare("INSERT INTO users (username, hash, email) VALUES (?, ?, ?);");
-const getUserByUsernameStatement = db.prepare("SELECT id, username, email from users WHERE username = ?;");
-const loginStatement = db.prepare("SELECT id, username, hash, email FROM users WHERE username = ?;");
+const createUserStatement = db.prepare('INSERT INTO users (username, hash, email) VALUES (?, ?, ?);');
+const getUserByUsernameStatement = db.prepare('SELECT id, username, email from users WHERE username = ?;');
+const loginStatement = db.prepare('SELECT id, username, hash, email FROM users WHERE username = ?;');
export async function createUser(username, password, email) {
const hash = await bcrypt.hash(password, saltRounds);
diff --git a/main.js b/main.js
index 391a4fe..0b04edd 100644
--- a/main.js
+++ b/main.js
@@ -1,21 +1,21 @@
-import express from "express";
+import express from 'express';
-import helmet from "./middlewares/helmet.js";
-import gamesRouter from "./routes/games.js";
-import rootRouter from "./routes/root.js";
+import helmet from './middlewares/helmet.js';
+import gamesRouter from './routes/games.js';
+import rootRouter from './routes/root.js';
const app = express();
-app.set("trust proxy", 1);
+app.set('trust proxy', 1);
app.use(helmet);
-app.set("views", "./views");
-app.set("view engine", "ejs");
+app.set('views', './views');
+app.set('view engine', 'ejs');
-app.use("/games", gamesRouter);
-app.use("/static", express.static("static"));
-app.use("/", rootRouter);
+app.use('/games', gamesRouter);
+app.use('/static', express.static('static'));
+app.use('/', rootRouter);
-if (process.env.NODE_ENV !== "test") {
+if (process.env.NODE_ENV !== 'test') {
const port = process.env.PORT || 3000;
app.listen(port, () => console.log(`listening on port ${port}`));
}
diff --git a/middlewares/formParser.js b/middlewares/formParser.js
index 41134ac..b117045 100644
--- a/middlewares/formParser.js
+++ b/middlewares/formParser.js
@@ -1,3 +1,3 @@
-import bodyParser from "body-parser";
+import bodyParser from 'body-parser';
export default bodyParser.urlencoded({ extended: false });
diff --git a/middlewares/helmet.js b/middlewares/helmet.js
index 5ced2c3..67d6e98 100644
--- a/middlewares/helmet.js
+++ b/middlewares/helmet.js
@@ -1,10 +1,10 @@
-import helmet from "helmet";
+import helmet from 'helmet';
const myHelmet = helmet({
contentSecurityPolicy: {
directives: {
...helmet.contentSecurityPolicy.getDefaultDirectives(),
- "script-src": ["'self'", "'unsafe-inline'"],
+ 'script-src': ['\'self\'', '\'unsafe-inline\''],
},
},
});
diff --git a/middlewares/requireAuth.js b/middlewares/requireAuth.js
index 1ea6deb..4d85e43 100644
--- a/middlewares/requireAuth.js
+++ b/middlewares/requireAuth.js
@@ -2,7 +2,7 @@ function requireAuth(req, res, next) {
if (req.session.user !== undefined) {
return next();
}
- return res.redirect(302, "/login");
+ return res.redirect(302, '/login');
}
export default requireAuth;
diff --git a/middlewares/sessions.js b/middlewares/sessions.js
index 901c262..30f5c49 100644
--- a/middlewares/sessions.js
+++ b/middlewares/sessions.js
@@ -1,21 +1,21 @@
-import expressSession from "express-session";
-import Database from "better-sqlite3";
-import sqliteStore from "better-sqlite3-session-store";
+import expressSession from 'express-session';
+import Database from 'better-sqlite3';
+import sqliteStore from 'better-sqlite3-session-store';
const SqliteStore = sqliteStore(expressSession);
const db = new Database(
- process.env.NODE_ENV === "test" ? "testsessions.db" : "sessions.db",
- process.env.NODE_ENV === "development" ? { verbose: console.log } : null
+ process.env.NODE_ENV === 'test' ? 'testsessions.db' : 'sessions.db',
+ process.env.NODE_ENV === 'development' ? { verbose: console.log } : null
);
-const secret = process.env.SESSION_SECRET || "secret";
+const secret = process.env.SESSION_SECRET || 'secret';
const session = expressSession({
cookie: {
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 15, // 15 days
- sameSite: "Strict",
- secure: process.env.NODE_ENV === "production" ? true : false,
+ sameSite: 'Strict',
+ secure: process.env.NODE_ENV === 'production' ? true : false,
},
- name: "JDMSessionId",
+ name: 'JDMSessionId',
saveUninitialized: false,
secret: secret,
store: new SqliteStore({
@@ -26,7 +26,7 @@ const session = expressSession({
}
}),
resave: false,
- unset: "destroy",
+ unset: 'destroy',
});
export default session;
diff --git a/routes/games.js b/routes/games.js
index 3a27cdb..5c4022c 100644
--- a/routes/games.js
+++ b/routes/games.js
@@ -1,18 +1,18 @@
-import express from "express";
+import express from 'express';
-import { gameId_get } from "../controllers/games/gameId.js";
-import { root_get, root_post } from "../controllers/games/root.js";
-import bodyParser from "../middlewares/formParser.js";
-import requireAuth from "../middlewares/requireAuth.js";
-import session from "../middlewares/sessions.js";
-import { checkName, checkUsername } from "../utils/checks.js";
+import { gameId_get } from '../controllers/games/gameId.js';
+import { root_get, root_post } from '../controllers/games/root.js';
+import bodyParser from '../middlewares/formParser.js';
+import requireAuth from '../middlewares/requireAuth.js';
+import session from '../middlewares/sessions.js';
+import { checkName, checkUsername } from '../utils/checks.js';
const router = express.Router();
router.use(session);
router.use(requireAuth);
-router.get("/", root_get);
-router.post("/", [bodyParser, checkName, checkUsername], root_post);
-router.get("/:gameId(\\d+)", gameId_get);
+router.get('/', root_get);
+router.post('/', [bodyParser, checkName, checkUsername], root_post);
+router.get('/:gameId(\\d+)', gameId_get);
export default router;
diff --git a/routes/root.js b/routes/root.js
index 863b99d..ee63748 100644
--- a/routes/root.js
+++ b/routes/root.js
@@ -1,18 +1,18 @@
-import express from "express";
+import express from 'express';
-import { login_get, login_post } from "../controllers/root/login.js";
-import { logout_get } from "../controllers/root/logout.js";
-import { root_get } from "../controllers/root/root.js";
-import bodyParser from "../middlewares/formParser.js";
-import session from "../middlewares/sessions.js";
-import { checkUsername, checkPassword } from "../utils/checks.js";
+import { login_get, login_post } from '../controllers/root/login.js';
+import { logout_get } from '../controllers/root/logout.js';
+import { root_get } from '../controllers/root/root.js';
+import bodyParser from '../middlewares/formParser.js';
+import session from '../middlewares/sessions.js';
+import { checkUsername, checkPassword } from '../utils/checks.js';
const router = express.Router();
router.use(session);
-router.get("/", root_get);
-router.get("/login", login_get);
-router.post("/login", [bodyParser, checkUsername, checkPassword], login_post);
-router.get("/logout", logout_get);
+router.get('/', root_get);
+router.get('/login', login_get);
+router.post('/login', [bodyParser, checkUsername, checkPassword], login_post);
+router.get('/logout', logout_get);
export default router;
diff --git a/tests/games.spec.js b/tests/games.spec.js
index 00ae1e7..1d5333c 100644
--- a/tests/games.spec.js
+++ b/tests/games.spec.js
@@ -1,23 +1,23 @@
-import { beforeEach, describe, test } from "vitest";
-import supertest from "supertest";
+import { beforeEach, describe, test } from 'vitest';
+import supertest from 'supertest';
-import app from "../main.js";
+import app from '../main.js';
-describe.concurrent("Games handlers tests", function() {
- describe.concurrent("When not logged in", function() {
- test("GET /games", async function() { await supertest(app).get("/games").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
- test("GET /games/1", async function() { await supertest(app).get("/games").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
+describe.concurrent('Games handlers tests', function() {
+ describe.concurrent('When not logged in', function() {
+ test('GET /games', async function() { await supertest(app).get('/games').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
+ test('GET /games/1', async function() { await supertest(app).get('/games').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
});
- describe.concurrent("With valid credentials", function() {
+ describe.concurrent('With valid credentials', function() {
beforeEach(async function(ctx) {
- const authResponse = await supertest(app).post("/login")
- .send("username=Alice&password=Alice42!")
- .expect("Content-Type", /text\/plain/)
- .expect("set-cookie", /JDMSessionId=/)
+ const authResponse = await supertest(app).post('/login')
+ .send('username=Alice&password=Alice42!')
+ .expect('Content-Type', /text\/plain/)
+ .expect('set-cookie', /JDMSessionId=/)
.expect(302, /Redirecting to \/games$/);
- ctx.cookie = authResponse.get("Set-Cookie");
+ ctx.cookie = authResponse.get('Set-Cookie');
});
- test("GET /games", async function(ctx) { await supertest(app).get("/games").set("Cookie", ctx.cookie).expect("Content-Type", /text\/html/).expect(200, /<td><a href="\/games\/1">Alice vs Bob<\/a><\/td>/); });
- test("GET /games/1", async function(ctx) { await supertest(app).get("/games/1").set("Cookie", ctx.cookie).expect("Content-Type", /text\/html/).expect(200, /<h2>Alice vs Bob<\/h2>/); });
+ test('GET /games', async function(ctx) { await supertest(app).get('/games').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /<td><a href="\/games\/1">Alice vs Bob<\/a><\/td>/); });
+ test('GET /games/1', async function(ctx) { await supertest(app).get('/games/1').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /<h2>Alice vs Bob<\/h2>/); });
});
});
diff --git a/tests/root.spec.js b/tests/root.spec.js
index 308d35c..34a8328 100644
--- a/tests/root.spec.js
+++ b/tests/root.spec.js
@@ -1,36 +1,36 @@
-import { beforeEach, describe, it } from "vitest";
-import supertest from "supertest";
+import { beforeEach, describe, it } from 'vitest';
+import supertest from 'supertest';
-import app from "../main.js";
+import app from '../main.js';
const request = supertest(app);
-describe.concurrent("Root handlers tests", function() {
- describe.concurrent("When not logged in", function() {
- it("GET /", async function() { await request.get("/").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
- it("GET /login", async function() { await request.get("/login").expect("Content-Type", /text\/html/).expect(200, /<form action="\/login" method="post">/); });
- it("GET /logout", async function() { await request.get("/logout").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/$/); });
+describe.concurrent('Root handlers tests', function() {
+ describe.concurrent('When not logged in', function() {
+ it('GET /', async function() { await request.get('/').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
+ it('GET /login', async function() { await request.get('/login').expect('Content-Type', /text\/html/).expect(200, /<form action="\/login" method="post">/); });
+ it('GET /logout', async function() { await request.get('/logout').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/$/); });
});
- describe.concurrent("With valid credentials", function() {
+ describe.concurrent('With valid credentials', function() {
beforeEach(async function(ctx) {
- const authResponse = await request.post("/login")
- .send("username=Alice&password=Alice42!")
- .expect("Content-Type", /text\/plain/)
- .expect("set-cookie", /JDMSessionId=/)
+ const authResponse = await request.post('/login')
+ .send('username=Alice&password=Alice42!')
+ .expect('Content-Type', /text\/plain/)
+ .expect('set-cookie', /JDMSessionId=/)
.expect(302, /Redirecting to \/games$/);
- ctx.cookie = authResponse.get("Set-Cookie");
+ ctx.cookie = authResponse.get('Set-Cookie');
});
- it("GET /", async function(ctx) { await request.get("/").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/games$/); });
- it("GET /login", async function(ctx) { await request.get("/login").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/games$/); });
- describe("logout", function() {
+ it('GET /', async function(ctx) { await request.get('/').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/games$/); });
+ it('GET /login', async function(ctx) { await request.get('/login').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/games$/); });
+ describe('logout', function() {
beforeEach(async function(ctx) {
- await request.get("/logout").set("cookie", ctx.cookie).expect("content-type", /text\/plain/).expect("set-cookie", /JDMSessionId=;/).expect(302, /Redirecting to \/$/);
+ await request.get('/logout').set('cookie', ctx.cookie).expect('content-type', /text\/plain/).expect('set-cookie', /JDMSessionId=;/).expect(302, /Redirecting to \/$/);
});
- describe.concurrent("all handlers with the now invalid cookie", async function() {
- it("GET /", async function(ctx) { await request.get("/").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
- it("GET /login", async function(ctx) { await request.get("/login").set("Cookie", ctx.cookie).expect("Content-Type", /text\/html/).expect(200, /<form action="\/login" method="post">/); });
- it("GET /logout", async function(ctx) { await request.get("/logout").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/$/); });
+ describe.concurrent('all handlers with the now invalid cookie', async function() {
+ it('GET /', async function(ctx) { await request.get('/').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
+ it('GET /login', async function(ctx) { await request.get('/login').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /<form action="\/login" method="post">/); });
+ it('GET /logout', async function(ctx) { await request.get('/logout').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/$/); });
});
});
});
diff --git a/utils/board.js b/utils/board.js
index f9a3b9d..523e1ec 100644
--- a/utils/board.js
+++ b/utils/board.js
@@ -1,19 +1,19 @@
export const emptyBoard = [
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ]
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ],
+ [ '', '', '', '', '','', '', '', '', '', '', '', '', '', '' ]
];
export const letters_total = 102;
diff --git a/utils/checks.js b/utils/checks.js
index 85c51df..e823cf7 100644
--- a/utils/checks.js
+++ b/utils/checks.js
@@ -1,15 +1,15 @@
-import { check } from "express-validator";
+import { check } from 'express-validator';
-export const checkName = check("name")
+export const checkName = check('name')
.trim()
.matches(/^[a-z][-a-z0-9_]+$/i)
- .withMessage("Un identifiant d'au moins deux charactères est requis.");
+ .withMessage('Un identifiant d\'au moins deux charactères est requis.');
-export const checkPassword = check("password")
+export const checkPassword = check('password')
.isStrongPassword()
- .withMessage("Veuillez utiliser un mot de passe d'au moins 8 caractères contenant au moins une minuscule, majuscule, chiffre et charactère spécial.");
+ .withMessage('Veuillez utiliser un mot de passe d\'au moins 8 caractères contenant au moins une minuscule, majuscule, chiffre et charactère spécial.');
-export const checkUsername = check("username")
+export const checkUsername = check('username')
.trim()
.matches(/^[a-z][-a-z0-9_]+$/i)
- .withMessage("Un identifiant d'au moins deux charactères est requis.");
+ .withMessage('Un identifiant d\'au moins deux charactères est requis.');