@galadrim/galadmin 0.1.223 → 0.1.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +1 -0
- package/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/front/ckeditor5-build/node_modules/.bin/semver +12 -0
- package/src/front/ckeditor5-build/node_modules/.bin/semver.cmd +17 -0
- package/src/front/ckeditor5-build/node_modules/.bin/semver.ps1 +28 -0
- package/src/front/ckeditor5-build/node_modules/semver/bin/semver.js +0 -0
- package/src/index.ts +10 -8
- package/src/types/config.ts +1 -0
package/dist/types/config.d.ts
CHANGED
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -152,7 +152,7 @@ export default (db, config, user) => {
|
|
|
152
152
|
const sqlAnd = (conditions) => {
|
|
153
153
|
const existingConditions = [];
|
|
154
154
|
for (const condition of conditions) {
|
|
155
|
-
if (condition) {
|
|
155
|
+
if (condition && condition.length > 0) {
|
|
156
156
|
existingConditions.push(condition)
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -x "$basedir/node" ]; then
|
|
9
|
+
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
|
10
|
+
else
|
|
11
|
+
exec node "$basedir/../semver/bin/semver.js" "$@"
|
|
12
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@ECHO off
|
|
2
|
+
GOTO start
|
|
3
|
+
:find_dp0
|
|
4
|
+
SET dp0=%~dp0
|
|
5
|
+
EXIT /b
|
|
6
|
+
:start
|
|
7
|
+
SETLOCAL
|
|
8
|
+
CALL :find_dp0
|
|
9
|
+
|
|
10
|
+
IF EXIST "%dp0%\node.exe" (
|
|
11
|
+
SET "_prog=%dp0%\node.exe"
|
|
12
|
+
) ELSE (
|
|
13
|
+
SET "_prog=node"
|
|
14
|
+
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
6
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
7
|
+
# are installed in the same directory
|
|
8
|
+
$exe=".exe"
|
|
9
|
+
}
|
|
10
|
+
$ret=0
|
|
11
|
+
if (Test-Path "$basedir/node$exe") {
|
|
12
|
+
# Support pipeline input
|
|
13
|
+
if ($MyInvocation.ExpectingInput) {
|
|
14
|
+
$input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
|
15
|
+
} else {
|
|
16
|
+
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
|
17
|
+
}
|
|
18
|
+
$ret=$LASTEXITCODE
|
|
19
|
+
} else {
|
|
20
|
+
# Support pipeline input
|
|
21
|
+
if ($MyInvocation.ExpectingInput) {
|
|
22
|
+
$input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
|
|
23
|
+
} else {
|
|
24
|
+
& "node$exe" "$basedir/../semver/bin/semver.js" $args
|
|
25
|
+
}
|
|
26
|
+
$ret=$LASTEXITCODE
|
|
27
|
+
}
|
|
28
|
+
exit $ret
|
|
File without changes
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ import * as mysql2 from 'mysql2/promise';
|
|
|
6
6
|
import * as pg from 'pg';
|
|
7
7
|
import dbManager from "./utils/dbManager";
|
|
8
8
|
import * as bcrypt from "bcryptjs";
|
|
9
|
-
import * as argon from 'argon2';
|
|
10
9
|
|
|
11
10
|
import * as fs from "fs";
|
|
12
11
|
import * as path from "path";
|
|
@@ -66,15 +65,18 @@ export default (config: Config): any => {
|
|
|
66
65
|
name: 'galadmin.sid'
|
|
67
66
|
}));
|
|
68
67
|
|
|
69
|
-
const passwordMatch = async (password: string, hash: string) => {
|
|
68
|
+
const passwordMatch = async (password: string, hash: string, useArgon2: boolean) => {
|
|
70
69
|
if (password === hash || bcrypt.compareSync(password, hash)) {
|
|
71
70
|
return true;
|
|
72
71
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
if (useArgon2) {
|
|
73
|
+
try {
|
|
74
|
+
const argon = await import('argon2');
|
|
75
|
+
if (await argon.verify(hash, password)) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
} catch (e) { }
|
|
79
|
+
}
|
|
78
80
|
return false;
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -88,7 +90,7 @@ export default (config: Config): any => {
|
|
|
88
90
|
const { rows } = await db.query(`SELECT * FROM ?? WHERE ?? = ? ${filters}`, [authRole.table, authRole.usernameField, req.body.username]);
|
|
89
91
|
let user;
|
|
90
92
|
for (const row of rows) {
|
|
91
|
-
if (await passwordMatch(req.body.password, row[authRole.passwordField])) {
|
|
93
|
+
if (await passwordMatch(req.body.password, row[authRole.passwordField], authRole.useArgon2)) {
|
|
92
94
|
user = row;
|
|
93
95
|
break;
|
|
94
96
|
}
|