Password encryption

This commit is contained in:
2024-11-20 10:43:48 +01:00
parent f923b34b77
commit 9b04e0ce69
12 changed files with 289 additions and 43 deletions

View File

@@ -2,7 +2,6 @@
"data": [ "data": [
{ {
"username": "hagemeister93", "username": "hagemeister93",
"password": "Xjt3qb5t",
"email": "hagemeister93@gmail.com", "email": "hagemeister93@gmail.com",
"firstName": "Laurin", "firstName": "Laurin",
"lastName": "Hagemeister", "lastName": "Hagemeister",
@@ -24,7 +23,6 @@
}, },
{ {
"username": "katjaStoiber", "username": "katjaStoiber",
"password": "target123",
"email": "k.stoiber@uni-hannover.de", "email": "k.stoiber@uni-hannover.de",
"firstName": "Katja", "firstName": "Katja",
"lastName": "Stoiber", "lastName": "Stoiber",
@@ -46,7 +44,6 @@
}, },
{ {
"username": "oetkerohnek", "username": "oetkerohnek",
"password": "iloveyou",
"email": "oetker30625@gmx.com", "email": "oetker30625@gmx.com",
"firstName": "Luna", "firstName": "Luna",
"lastName": "Oeter", "lastName": "Oeter",
@@ -74,7 +71,6 @@
}, },
{ {
"username": "duranduran", "username": "duranduran",
"password": "H4nn0ver",
"email": "dduran@hannover.de", "email": "dduran@hannover.de",
"firstName": "Jürgen", "firstName": "Jürgen",
"lastName": "Durand", "lastName": "Durand",
@@ -102,7 +98,6 @@
}, },
{ {
"username": "guitarhero", "username": "guitarhero",
"password": "gwerty123",
"email": "guitarheroFurti@gmail.com", "email": "guitarheroFurti@gmail.com",
"firstName": "Frederik", "firstName": "Frederik",
"lastName": "Furtwängler", "lastName": "Furtwängler",
@@ -124,7 +119,6 @@
}, },
{ {
"username": "herbstMareike", "username": "herbstMareike",
"password": "qhsrbpgrs",
"email": "m.herbst@uni-hannover.de", "email": "m.herbst@uni-hannover.de",
"firstName": "Mareike", "firstName": "Mareike",
"lastName": "Herbst", "lastName": "Herbst",
@@ -146,7 +140,6 @@
}, },
{ {
"username": "seibertmitb", "username": "seibertmitb",
"password": "{jkz+WvQe",
"email": "janna-seibert@yahoo.com", "email": "janna-seibert@yahoo.com",
"firstName": "Janna", "firstName": "Janna",
"lastName": "Seibert", "lastName": "Seibert",

View File

@@ -1,9 +1,10 @@
import { Table, Column, Model, HasMany, Unique, BelongsTo, ForeignKey } from 'sequelize-typescript'; import { Table, Column, Model, HasMany, Unique, BelongsTo, ForeignKey, BeforeCreate, BeforeUpdate } from 'sequelize-typescript';
import { Order } from '../ordering/order.model'; import { Order } from '../ordering/order.model';
import { Address } from './address.model'; import { Address } from './address.model';
import { Payment } from './payment.model'; import { Payment } from './payment.model';
import { AccountRole } from './accountRole.model'; import { AccountRole } from './accountRole.model';
import { Rating } from '../acts/rating.model'; import { Rating } from '../acts/rating.model';
import { encryptString } from '../../scripts/encryptScripts';
@Table({ timestamps: false }) @Table({ timestamps: false })
export class Account extends Model { export class Account extends Model {
@@ -44,4 +45,12 @@ export class Account extends Model {
@BelongsTo(() => AccountRole) @BelongsTo(() => AccountRole)
accountRole: AccountRole accountRole: AccountRole
// Hooks
@BeforeCreate
static async encryptPassword(instance: Account) {
instance.dataValues.password = encryptString(instance.dataValues.password)
}
} }

View File

@@ -8,6 +8,7 @@ import { Exercise } from "../models/exercises/exercise.model";
import { sequelize } from "../database"; import { sequelize } from "../database";
import jwt from "jsonwebtoken" import jwt from "jsonwebtoken"
import { verifyToken } from "../middlewares/auth.middleware"; import { verifyToken } from "../middlewares/auth.middleware";
import { encryptString } from "../scripts/encryptScripts";
export const account = Router() export const account = Router()
@@ -22,12 +23,14 @@ account.get("/", (req: Request, res: Response) => {
// Login user // Login user
account.get("/login", async (req: Request, res: Response) => { account.get("/login", async (req: Request, res: Response) => {
const encryptedPassword = encryptString(String(req.query.password))
// Using raw SQL code for SQL injections! // Using raw SQL code for SQL injections!
const [results, metadata] = const [results, metadata] =
await sequelize.query( await sequelize.query(
"SELECT * FROM Accounts " + "SELECT * FROM Accounts " +
"WHERE (username='" + req.query.username + "WHERE (username='" + req.query.username +
"' AND password='" + req.query.password + "')" "' AND password='" + encryptedPassword + "')"
) )
if (results.length != 0) { if (results.length != 0) {

View File

@@ -204,7 +204,19 @@ export async function prepopulateDatabase() {
AccountRole.bulkCreate(accountRoles.data) AccountRole.bulkCreate(accountRoles.data)
let chars = "0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (let account of accounts.data) { for (let account of accounts.data) {
// Create a random 12 char password
let password = ""
for (var i = 0; i <= 12; i++) {
var randomNumber = Math.floor(Math.random() * chars.length);
password += chars.substring(randomNumber, randomNumber +1);
}
account["password"] = password
await Account.create(account) await Account.create(account)
.then(async dataset => { .then(async dataset => {
for (let address of account.addresses) { for (let address of account.addresses) {

View File

@@ -0,0 +1,32 @@
import { createCipheriv, randomBytes } from "crypto"
export function encryptString(value: string): string {
// Defining algorithm
const algorithm = 'aes-256-cbc';
// Defining key
const key = Buffer.from(
[
0xa, 0xc, 0xc, 0x0, 0xf, 0xf, 0xa, 0x6,
0x4, 0xe, 0xc, 0x5, 0x0, 0xe, 0xa, 0xa,
0x1, 0x3, 0x7, 0xf, 0xf, 0x7, 0x8, 0x4,
0xd, 0xf, 0x3, 0x9, 0xc, 0x2, 0xc, 0xc
]
)
// Defining iv
const iv = Buffer.from(
[
0xb, 0xd, 0x6, 0x6, 0xa, 0x5, 0xf, 0xa, 0x6, 0xb, 0xe, 0x4, 0x3, 0xa, 0x9, 0x2
]
)
let cipher = createCipheriv(algorithm, Buffer.from(key), iv);
// let cipher = createCipheriv(algorithm, Buffer.from(ENCRYPTION_KEY, 'hex'), iv);
let encrypted = cipher.update(value)
encrypted = Buffer.concat([encrypted, cipher.final()])
return encrypted.toString("hex")
}

212
package-lock.json generated
View File

@@ -13,8 +13,10 @@
"@types/multer": "^1.4.12", "@types/multer": "^1.4.12",
"@vueuse/core": "^11.1.0", "@vueuse/core": "^11.1.0",
"axios": "^1.7.7", "axios": "^1.7.7",
"bcrypt": "^5.1.1",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"cors": "^2.8.5", "cors": "^2.8.5",
"cryptojs": "^2.5.3",
"electron-squirrel-startup": "^1.0.1", "electron-squirrel-startup": "^1.0.1",
"express": "^4.21.1", "express": "^4.21.1",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
@@ -39,6 +41,7 @@
"devDependencies": { "devDependencies": {
"@electron-toolkit/tsconfig": "^1.0.1", "@electron-toolkit/tsconfig": "^1.0.1",
"@electron/fuses": "^1.8.0", "@electron/fuses": "^1.8.0",
"@types/bcrypt": "^5.0.2",
"@types/cors": "^2.8.17", "@types/cors": "^2.8.17",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.7", "@types/jsonwebtoken": "^9.0.7",
@@ -1644,6 +1647,90 @@
"node": ">= 10.0.0" "node": ">= 10.0.0"
} }
}, },
"node_modules/@mapbox/node-pre-gyp": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz",
"integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==",
"license": "BSD-3-Clause",
"dependencies": {
"detect-libc": "^2.0.0",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.7",
"nopt": "^5.0.0",
"npmlog": "^5.0.1",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"tar": "^6.1.11"
},
"bin": {
"node-pre-gyp": "bin/node-pre-gyp"
}
},
"node_modules/@mapbox/node-pre-gyp/node_modules/are-we-there-yet": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
"integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
"deprecated": "This package is no longer supported.",
"license": "ISC",
"dependencies": {
"delegates": "^1.0.0",
"readable-stream": "^3.6.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@mapbox/node-pre-gyp/node_modules/gauge": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz",
"integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==",
"deprecated": "This package is no longer supported.",
"license": "ISC",
"dependencies": {
"aproba": "^1.0.3 || ^2.0.0",
"color-support": "^1.1.2",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.1",
"object-assign": "^4.1.1",
"signal-exit": "^3.0.0",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1",
"wide-align": "^1.1.2"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@mapbox/node-pre-gyp/node_modules/npmlog": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
"integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
"deprecated": "This package is no longer supported.",
"license": "ISC",
"dependencies": {
"are-we-there-yet": "^2.0.0",
"console-control-strings": "^1.1.0",
"gauge": "^3.0.0",
"set-blocking": "^2.0.0"
}
},
"node_modules/@mapbox/node-pre-gyp/node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"deprecated": "Rimraf versions prior to v4 are no longer supported",
"license": "ISC",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@mdi/font": { "node_modules/@mdi/font": {
"version": "7.4.47", "version": "7.4.47",
"resolved": "https://registry.npmjs.org/@mdi/font/-/font-7.4.47.tgz", "resolved": "https://registry.npmjs.org/@mdi/font/-/font-7.4.47.tgz",
@@ -2009,6 +2096,16 @@
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/bcrypt": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/@types/bcrypt/-/bcrypt-5.0.2.tgz",
"integrity": "sha512-6atioO8Y75fNcbmj0G7UjI9lXN2pQ/IGJ2FWT4a/btd0Lk9lQalHLKhkgKVZ3r+spnmWUKfbMi1GEe9wyHQfNQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/body-parser": { "node_modules/@types/body-parser": {
"version": "1.19.5", "version": "1.19.5",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
@@ -2577,7 +2674,6 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/accepts": { "node_modules/accepts": {
@@ -2621,7 +2717,6 @@
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"debug": "4" "debug": "4"
@@ -2634,7 +2729,6 @@
"version": "4.3.7", "version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ms": "^2.1.3" "ms": "^2.1.3"
@@ -2652,7 +2746,6 @@
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"devOptional": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/agentkeepalive": { "node_modules/agentkeepalive": {
@@ -2720,7 +2813,6 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@@ -2910,7 +3002,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/archiver": { "node_modules/archiver": {
@@ -3149,6 +3240,26 @@
], ],
"license": "MIT" "license": "MIT"
}, },
"node_modules/bcrypt": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.1.tgz",
"integrity": "sha512-AGBHOG5hPYZ5Xl9KXzU5iKq9516yEmvCKDg3ecP5kX2aB6UqTeXZxk2ELnDgDm6BQSMlLt9rDB4LoSMx0rYwww==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.11",
"node-addon-api": "^5.0.0"
},
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/bcrypt/node_modules/node-addon-api": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz",
"integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==",
"license": "MIT"
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
@@ -3851,7 +3962,6 @@
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
"devOptional": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
"color-support": "bin.js" "color-support": "bin.js"
@@ -4055,7 +4165,6 @@
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/content-disposition": { "node_modules/content-disposition": {
@@ -4247,6 +4356,14 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/cryptojs": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/cryptojs/-/cryptojs-2.5.3.tgz",
"integrity": "sha512-+rdPl1UCxE8s3R94NNn+zMKOiI4MJ7dyh3X0c5uBL3btDr4zQ6acd7f9mY7Wb5MrccZEi2Rrha3OEtLcc5XXog==",
"engines": {
"node": "*"
}
},
"node_modules/css-line-break": { "node_modules/css-line-break": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz",
@@ -4375,7 +4492,6 @@
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
"devOptional": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/denque": { "node_modules/denque": {
@@ -4847,7 +4963,6 @@
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"devOptional": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/encodeurl": { "node_modules/encodeurl": {
@@ -5641,7 +5756,6 @@
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/hasown": { "node_modules/hasown": {
@@ -5774,7 +5888,6 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"agent-base": "6", "agent-base": "6",
@@ -5788,7 +5901,6 @@
"version": "4.3.7", "version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ms": "^2.1.3" "ms": "^2.1.3"
@@ -5806,7 +5918,6 @@
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"devOptional": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/humanize-ms": { "node_modules/humanize-ms": {
@@ -6006,7 +6117,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@@ -6503,6 +6613,30 @@
"@jridgewell/sourcemap-codec": "^1.5.0" "@jridgewell/sourcemap-codec": "^1.5.0"
} }
}, },
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
"license": "MIT",
"dependencies": {
"semver": "^6.0.0"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/make-dir/node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/make-error": { "node_modules/make-error": {
"version": "1.3.6", "version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
@@ -6959,6 +7093,26 @@
"semver": "^7.3.5" "semver": "^7.3.5"
} }
}, },
"node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"license": "MIT",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-gyp": { "node_modules/node-gyp": {
"version": "8.4.1", "version": "8.4.1",
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz",
@@ -7121,7 +7275,6 @@
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
"license": "ISC", "license": "ISC",
"optional": true,
"dependencies": { "dependencies": {
"abbrev": "1" "abbrev": "1"
}, },
@@ -8367,7 +8520,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/set-function-length": { "node_modules/set-function-length": {
@@ -8448,7 +8600,6 @@
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"devOptional": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/simple-concat": { "node_modules/simple-concat": {
@@ -8724,7 +8875,6 @@
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
@@ -8755,7 +8905,6 @@
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ansi-regex": "^5.0.1" "ansi-regex": "^5.0.1"
@@ -9081,6 +9230,12 @@
"nodetouch": "bin/nodetouch.js" "nodetouch": "bin/nodetouch.js"
} }
}, },
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/tree-kill": { "node_modules/tree-kill": {
"version": "1.2.2", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
@@ -9561,6 +9716,22 @@
"defaults": "^1.0.3" "defaults": "^1.0.3"
} }
}, },
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"license": "MIT",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/which": { "node_modules/which": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -9581,7 +9752,6 @@
"version": "1.1.5", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
"integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
"devOptional": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"string-width": "^1.0.2 || 2 || 3 || 4" "string-width": "^1.0.2 || 2 || 3 || 4"

View File

@@ -37,8 +37,10 @@
"@types/multer": "^1.4.12", "@types/multer": "^1.4.12",
"@vueuse/core": "^11.1.0", "@vueuse/core": "^11.1.0",
"axios": "^1.7.7", "axios": "^1.7.7",
"bcrypt": "^5.1.1",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"cors": "^2.8.5", "cors": "^2.8.5",
"cryptojs": "^2.5.3",
"electron-squirrel-startup": "^1.0.1", "electron-squirrel-startup": "^1.0.1",
"express": "^4.21.1", "express": "^4.21.1",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
@@ -63,6 +65,7 @@
"devDependencies": { "devDependencies": {
"@electron-toolkit/tsconfig": "^1.0.1", "@electron-toolkit/tsconfig": "^1.0.1",
"@electron/fuses": "^1.8.0", "@electron/fuses": "^1.8.0",
"@types/bcrypt": "^5.0.2",
"@types/cors": "^2.8.17", "@types/cors": "^2.8.17",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.7", "@types/jsonwebtoken": "^9.0.7",

View File

@@ -58,26 +58,20 @@ const stringRules = [
<v-text-field <v-text-field
:label="$t('account.userData.email')" :label="$t('account.userData.email')"
v-model="accountStore.userAccount.email" v-model="accountStore.userAccount.email"
variant="outlined"
hide-details
disabled disabled
/> />
</v-col> </v-col>
</v-row>
<v-row>
<v-col> <v-col>
<v-text-field <v-text-field
:label="$t('account.userData.username')" :label="$t('account.userData.username')"
v-model="accountStore.userAccount.username" v-model="accountStore.userAccount.username"
variant="outlined"
hide-details
disabled disabled
/> />
</v-col> </v-col>
<v-col>
<v-text-field
:label="$t('account.userData.password')"
v-model="accountStore.userAccount.password"
type="password"
:rules="passwordRules"
/>
</v-col>
</v-row> </v-row>
<v-row> <v-row>
@@ -85,14 +79,18 @@ const stringRules = [
<v-text-field <v-text-field
:label="$t('account.userData.firstName')" :label="$t('account.userData.firstName')"
v-model="accountStore.userAccount.firstName" v-model="accountStore.userAccount.firstName"
variant="outlined"
:rules="stringRules" :rules="stringRules"
hide-details
/> />
</v-col> </v-col>
<v-col> <v-col>
<v-text-field <v-text-field
:label="$t('account.userData.lastName')" :label="$t('account.userData.lastName')"
v-model="accountStore.userAccount.lastName" v-model="accountStore.userAccount.lastName"
variant="outlined"
:rules="stringRules" :rules="stringRules"
hide-details
/> />
</v-col> </v-col>
</v-row> </v-row>

View File

@@ -11,7 +11,7 @@ const accountStore = useAccountStore()
<template> <template>
<card-view <card-view
icon="mdi-home" icon="mdi-home"
:title="$t('account.userData.address')" :title="$t('account.userData.address', 2)"
> >
<v-expansion-panels v-if="accountStore.userAccount.addresses.length > 0"> <v-expansion-panels v-if="accountStore.userAccount.addresses.length > 0">
<v-expansion-panel <v-expansion-panel
@@ -19,7 +19,15 @@ const accountStore = useAccountStore()
color="primary" color="primary"
> >
<template #title> <template #title>
{{ address.street + ' ' + address.houseNumber }} <div v-if="address.street != undefined">
{{ address.street }}
</div>
&nbsp;
<div v-if="address.houseNumber != undefined">
{{ address.houseNumber }}
</div>
</template> </template>
<template #text> <template #text>
@@ -29,7 +37,9 @@ const accountStore = useAccountStore()
:label="$t('account.userData.street')" :label="$t('account.userData.street')"
v-model="address.street" v-model="address.street"
:rules="getStringRules()" :rules="getStringRules()"
variant="outlined"
clearable clearable
hide-details
/> />
</v-col> </v-col>
<v-col> <v-col>
@@ -37,7 +47,9 @@ const accountStore = useAccountStore()
:label="$t('account.userData.houseNumber')" :label="$t('account.userData.houseNumber')"
v-model="address.houseNumber" v-model="address.houseNumber"
:rules="getNumberStartRules()" :rules="getNumberStartRules()"
variant="outlined"
clearable clearable
hide-details
/> />
</v-col> </v-col>
</v-row> </v-row>
@@ -48,7 +60,9 @@ const accountStore = useAccountStore()
:label="$t('account.userData.postalCode')" :label="$t('account.userData.postalCode')"
v-model="address.postalCode" v-model="address.postalCode"
:rules="getPostalRules()" :rules="getPostalRules()"
variant="outlined"
clearable clearable
hide-details
/> />
</v-col> </v-col>
<v-col> <v-col>
@@ -56,7 +70,9 @@ const accountStore = useAccountStore()
:label="$t('account.userData.placeOfResidence')" :label="$t('account.userData.placeOfResidence')"
v-model="address.city" v-model="address.city"
:rules="getStringRules()" :rules="getStringRules()"
variant="outlined"
clearable clearable
hide-details
/> />
</v-col> </v-col>
</v-row> </v-row>

View File

@@ -12,7 +12,7 @@ const accountStore = useAccountStore()
<template> <template>
<card-view <card-view
icon="mdi-currency-usd" icon="mdi-currency-usd"
:title="$t('account.userData.payment')" :title="$t('account.userData.payment', 2)"
> >
<v-row> <v-row>
<v-col> <v-col>
@@ -41,6 +41,8 @@ const accountStore = useAccountStore()
:label="$t('account.userData.bankName')" :label="$t('account.userData.bankName')"
v-model="payment.bankName" v-model="payment.bankName"
:rules="getStringRules()" :rules="getStringRules()"
variant="outlined"
hide-details
/> />
</v-col> </v-col>
<v-col> <v-col>
@@ -48,6 +50,8 @@ const accountStore = useAccountStore()
:label="$t('account.userData.iban')" :label="$t('account.userData.iban')"
v-model="payment.iban" v-model="payment.iban"
:rules="getIbanRules()" :rules="getIbanRules()"
variant="outlined"
hide-details
/> />
</v-col> </v-col>
</v-row> </v-row>

View File

@@ -177,6 +177,7 @@ export const useAccountStore = defineStore("accountStore", {
this.loggedIn = false this.loggedIn = false
this.privilegeBuy = false this.privilegeBuy = false
this.adminPanelVisible = false this.adminPanelVisible = false
this.userAccountToken = ""
feedbackStore.addSnackbar(BannerStateEnum.ACCOUNTLOGOUTSUCCESSFUL) feedbackStore.addSnackbar(BannerStateEnum.ACCOUNTLOGOUTSUCCESSFUL)
}, },

View File

@@ -73,9 +73,14 @@ export const usePreferencesStore = defineStore('preferencesStore', {
*/ */
async resetDb() { async resetDb() {
const feedbackStore = useFeedbackStore() const feedbackStore = useFeedbackStore()
const accountStore = useAccountStore()
this.serverState = ServerStateEnum.PENDING this.serverState = ServerStateEnum.PENDING
this.fetchInProgress = true this.fetchInProgress = true
// Logout user
accountStore.logout()
await resetDatabase() await resetDatabase()
.then(result => { .then(result => {
if (result.status == 200) { if (result.status == 200) {