Update dependencies and refactor authentication logic
- Replaced `bcrypt` with `bcryptjs` for compatibility in `authService.js` and `settingsService.js`. - Updated package versions in `package.json` and `package-lock.json`, including `multer`, `nodemailer`, and others. - Added storage management features in the frontend, including free storage calculation and localization updates for new terms in `falukant.json` files.
This commit is contained in:
1590
backend/package-lock.json
generated
1590
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"amqplib": "^0.10.4",
|
"amqplib": "^0.10.4",
|
||||||
"bcrypt": "^5.1.1",
|
"bcryptjs": "^2.4.3",
|
||||||
"connect-redis": "^7.1.1",
|
"connect-redis": "^7.1.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
@@ -26,9 +26,9 @@
|
|||||||
"i18n": "^0.15.1",
|
"i18n": "^0.15.1",
|
||||||
"joi": "^17.13.3",
|
"joi": "^17.13.3",
|
||||||
"jsdom": "^26.1.0",
|
"jsdom": "^26.1.0",
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^2.0.0",
|
||||||
"mysql2": "^3.10.3",
|
"mysql2": "^3.10.3",
|
||||||
"nodemailer": "^6.9.14",
|
"nodemailer": "^7.0.11",
|
||||||
"pg": "^8.12.0",
|
"pg": "^8.12.0",
|
||||||
"pg-hstore": "^2.3.4",
|
"pg-hstore": "^2.3.4",
|
||||||
"redis": "^4.7.0",
|
"redis": "^4.7.0",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import bcrypt from 'bcrypt';
|
import bcrypt from 'bcryptjs';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import User from '../models/community/user.js';
|
import User from '../models/community/user.js';
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ class SettingsService extends BaseService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify old password
|
// Verify old password
|
||||||
const bcrypt = await import('bcrypt');
|
const bcrypt = await import('bcryptjs');
|
||||||
const match = await bcrypt.compare(settings.oldpassword, user.password);
|
const match = await bcrypt.compare(settings.oldpassword, user.password);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
throw new Error('Old password is incorrect');
|
throw new Error('Old password is incorrect');
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
<input type="number" id="quantity" v-model.number="productionQuantity" min="1" max="200"/>
|
<input type="number" id="quantity" v-model.number="productionQuantity" min="1" max="200"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<p>
|
||||||
|
{{ $t('falukant.branch.production.storageAvailable') }}:
|
||||||
|
<strong>{{ freeStorage }}</strong>
|
||||||
|
</p>
|
||||||
<p>{{ $t('falukant.branch.production.cost') }}:
|
<p>{{ $t('falukant.branch.production.cost') }}:
|
||||||
<strong>{{ calculateProductionCost() }}</strong>
|
<strong>{{ calculateProductionCost() }}</strong>
|
||||||
</p>
|
</p>
|
||||||
@@ -67,10 +71,19 @@
|
|||||||
productionQuantity: 1,
|
productionQuantity: 1,
|
||||||
currentTime: Date.now(),
|
currentTime: Date.now(),
|
||||||
timer: null,
|
timer: null,
|
||||||
|
currentStorage: 0,
|
||||||
|
maxStorage: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
freeStorage() {
|
||||||
|
const diff = this.maxStorage - this.currentStorage;
|
||||||
|
return diff > 0 ? diff : 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.loadProductions();
|
await this.loadProductions();
|
||||||
|
await this.loadStorage();
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.currentTime = Date.now();
|
this.currentTime = Date.now();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -94,6 +107,15 @@
|
|||||||
console.error('Error loading productions:', error);
|
console.error('Error loading productions:', error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async loadStorage() {
|
||||||
|
try {
|
||||||
|
const { data } = await apiClient.get(`/api/falukant/storage/${this.branchId}`);
|
||||||
|
this.currentStorage = data.totalUsedCapacity;
|
||||||
|
this.maxStorage = data.maxCapacity;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading storage for production section:', error);
|
||||||
|
}
|
||||||
|
},
|
||||||
calculateProductionCost() {
|
calculateProductionCost() {
|
||||||
if (!this.products) return 0;
|
if (!this.products) return 0;
|
||||||
const product = this.products.find(p => p.id === this.selectedProduct);
|
const product = this.products.find(p => p.id === this.selectedProduct);
|
||||||
|
|||||||
@@ -180,6 +180,7 @@
|
|||||||
"info": "Details zur Produktion in der Niederlassung.",
|
"info": "Details zur Produktion in der Niederlassung.",
|
||||||
"selectProduct": "Produkt auswählen",
|
"selectProduct": "Produkt auswählen",
|
||||||
"quantity": "Menge",
|
"quantity": "Menge",
|
||||||
|
"storageAvailable": "Freier Lagerplatz",
|
||||||
"cost": "Kosten",
|
"cost": "Kosten",
|
||||||
"duration": "Dauer",
|
"duration": "Dauer",
|
||||||
"revenue": "Erlös",
|
"revenue": "Erlös",
|
||||||
|
|||||||
@@ -44,6 +44,9 @@
|
|||||||
},
|
},
|
||||||
"nobility": {
|
"nobility": {
|
||||||
"cooldown": "You can only advance again on {date}."
|
"cooldown": "You can only advance again on {date}."
|
||||||
|
},
|
||||||
|
"branchProduction": {
|
||||||
|
"storageAvailable": "Free storage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,6 +253,7 @@ export default {
|
|||||||
this.$refs.saleSection?.loadInventory();
|
this.$refs.saleSection?.loadInventory();
|
||||||
this.$refs.saleSection?.loadTransports();
|
this.$refs.saleSection?.loadTransports();
|
||||||
this.$refs.productionSection?.loadProductions();
|
this.$refs.productionSection?.loadProductions();
|
||||||
|
this.$refs.productionSection?.loadStorage();
|
||||||
this.$refs.storageSection?.loadStorageData();
|
this.$refs.storageSection?.loadStorageData();
|
||||||
this.$refs.revenueSection?.refresh && this.$refs.revenueSection.refresh();
|
this.$refs.revenueSection?.refresh && this.$refs.revenueSection.refresh();
|
||||||
});
|
});
|
||||||
@@ -379,10 +380,12 @@ export default {
|
|||||||
case 'production_ready':
|
case 'production_ready':
|
||||||
this.$refs.productionSection?.loadProductions();
|
this.$refs.productionSection?.loadProductions();
|
||||||
this.$refs.storageSection?.loadStorageData();
|
this.$refs.storageSection?.loadStorageData();
|
||||||
|
this.$refs.productionSection?.loadStorage();
|
||||||
this.$refs.saleSection?.loadInventory();
|
this.$refs.saleSection?.loadInventory();
|
||||||
break;
|
break;
|
||||||
case 'stock_change':
|
case 'stock_change':
|
||||||
this.$refs.storageSection?.loadStorageData();
|
this.$refs.storageSection?.loadStorageData();
|
||||||
|
this.$refs.productionSection?.loadStorage();
|
||||||
this.$refs.saleSection?.loadInventory();
|
this.$refs.saleSection?.loadInventory();
|
||||||
break;
|
break;
|
||||||
case 'price_update':
|
case 'price_update':
|
||||||
@@ -397,6 +400,7 @@ export default {
|
|||||||
case 'selled_items':
|
case 'selled_items':
|
||||||
this.$refs.saleSection?.loadInventory();
|
this.$refs.saleSection?.loadInventory();
|
||||||
this.$refs.storageSection?.loadStorageData();
|
this.$refs.storageSection?.loadStorageData();
|
||||||
|
this.$refs.productionSection?.loadStorage();
|
||||||
break;
|
break;
|
||||||
case 'falukantUpdateStatus':
|
case 'falukantUpdateStatus':
|
||||||
case 'falukantBranchUpdate':
|
case 'falukantBranchUpdate':
|
||||||
@@ -406,6 +410,7 @@ export default {
|
|||||||
|
|
||||||
if (this.$refs.productionSection) {
|
if (this.$refs.productionSection) {
|
||||||
this.$refs.productionSection.loadProductions();
|
this.$refs.productionSection.loadProductions();
|
||||||
|
this.$refs.productionSection.loadStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.$refs.storageSection) {
|
if (this.$refs.storageSection) {
|
||||||
|
|||||||
Reference in New Issue
Block a user