mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-23 23:18:18 +02:00
Fix password updates for administrators in production environments
Correctly import the production authentication module with the `.js` extension to resolve the ERR_MODULE_NOT_FOUND error. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/5WAXLXf
This commit is contained in:
1 parent
91ae0bebe7
commit
f42a999b61
3 files changed
+9
-3
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 281 KiB |
@@ -133,4 +133,10 @@ Preferred communication style: Simple, everyday language.
|
|||||||
#### Email Field Consistency in Edit Form
|
#### Email Field Consistency in Edit Form
|
||||||
- **Issue**: Email field was marked as required in edit form but optional in create form
|
- **Issue**: Email field was marked as required in edit form but optional in create form
|
||||||
- **Solution**: Removed `required` attribute and asterisk from email field in edit form
|
- **Solution**: Removed `required` attribute and asterisk from email field in edit form
|
||||||
- **Result**: Email field now consistently optional in both create and edit forms
|
- **Result**: Email field now consistently optional in both create and edit forms
|
||||||
|
|
||||||
|
#### Production Password Hashing Fix
|
||||||
|
- **Issue**: Admin password changes failed in production with ERR_MODULE_NOT_FOUND for localAuth.production
|
||||||
|
- **Root Cause**: Dynamic imports in production needed `.js` extension for compiled files
|
||||||
|
- **Solution**: Updated import paths to use `./localAuth.production.js` for production environment
|
||||||
|
- **Result**: Password hashing now works correctly in production for user updates
|
||||||
+2
-2
@@ -888,7 +888,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
// Hash password if provided (for local auth)
|
// Hash password if provided (for local auth)
|
||||||
if (userData.password) {
|
if (userData.password) {
|
||||||
// Import from the correct auth module based on environment
|
// Import from the correct auth module based on environment
|
||||||
const authModule = process.env.NODE_ENV === 'production' ? "./localAuth.production" : "./localAuth";
|
const authModule = process.env.NODE_ENV === 'production' ? "./localAuth.production.js" : "./localAuth";
|
||||||
const { hashPassword } = await import(authModule);
|
const { hashPassword } = await import(authModule);
|
||||||
userData.password = await hashPassword(userData.password);
|
userData.password = await hashPassword(userData.password);
|
||||||
}
|
}
|
||||||
@@ -946,7 +946,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
// Hash password if provided
|
// Hash password if provided
|
||||||
if (userData.password) {
|
if (userData.password) {
|
||||||
// Import from the correct auth module based on environment
|
// Import from the correct auth module based on environment
|
||||||
const authModule = process.env.NODE_ENV === 'production' ? "./localAuth.production" : "./localAuth";
|
const authModule = process.env.NODE_ENV === 'production' ? "./localAuth.production.js" : "./localAuth";
|
||||||
const { hashPassword } = await import(authModule);
|
const { hashPassword } = await import(authModule);
|
||||||
userData.password = await hashPassword(userData.password);
|
userData.password = await hashPassword(userData.password);
|
||||||
// Mark password as changed
|
// Mark password as changed
|
||||||
|
|||||||
Reference in new issue
Block a user