This commit is contained in:
omri zaher 2025-09-19 18:11:21 +03:00
parent 7531075afe
commit 8203a9a1b5

View file

@ -116,42 +116,39 @@ jobs:
echo "🔍 Checking container status..." echo "🔍 Checking container status..."
sudo docker ps sudo docker ps
# Create test user directly in MongoDB with dynamic bcrypt hash # Create test user directly in MongoDB with proper Wekan structure
echo "👤 Creating test user: omriza5" echo "👤 Creating test user: omriza5"
sudo docker exec wekan-app node -e " sudo docker exec wekan-db mongosh wekan --eval '
const bcrypt = require('bcrypt'); // Remove user if exists (for clean testing)
const { MongoClient } = require('mongodb'); db.users.deleteMany({username: "omriza5"});
async function createUser() { // Check if user already exists
const client = new MongoClient('mongodb://wekandb:27017'); const existingUser = db.users.findOne({username: "omriza5"});
await client.connect(); if (existingUser) {
const db = client.db('wekan'); print("User omriza5 already exists");
} else {
// Remove existing user // Generate bcrypt hash for password "123456"
await db.collection('users').deleteMany({username: 'omriza5'}); const userId = "omriza5_" + new Date().getTime();
// Hash password
const hashedPassword = bcrypt.hashSync('123456', 10);
const userId = 'omriza5_' + Date.now();
const now = new Date(); const now = new Date();
const result = await db.collection('users').insertOne({ // Create properly structured user (matches Wekan registration format)
const result = db.users.insertOne({
_id: userId, _id: userId,
username: 'omriza5', username: "omriza5",
emails: [{ address: 'omriza5@gmail.com', verified: false }], emails: [{ address: "omriza5@gmail.com", verified: false }],
services: { services: {
password: { password: {
bcrypt: hashedPassword // Correct bcrypt hash for "123456"
bcrypt: "$2b$10$0iGKuuJkS8V5VdI.ynE/QOm7hCUhPZNUlk8PZGmQQg5nE0Aj5gOGm"
} }
}, },
profile: { profile: {
boardView: 'board-view-swimlanes', boardView: "board-view-swimlanes",
listSortBy: '-modifiedAt', listSortBy: "-modifiedAt",
templatesBoardId: '', templatesBoardId: "",
cardTemplatesSwimlaneId: '', cardTemplatesSwimlaneId: "",
listTemplatesSwimlaneId: '', listTemplatesSwimlaneId: "",
boardTemplatesSwimlaneId: '', boardTemplatesSwimlaneId: "",
listWidths: {}, listWidths: {},
listConstraints: {}, listConstraints: {},
autoWidthBoards: {}, autoWidthBoards: {},
@ -161,18 +158,19 @@ jobs:
showWeekOfYear: true showWeekOfYear: true
}, },
isAdmin: false, isAdmin: false,
authenticationMethod: 'password', authenticationMethod: "password",
sessionData: {}, sessionData: {},
createdAt: now, createdAt: now,
modifiedAt: now modifiedAt: now
}); });
console.log('✅ User created with hash:', hashedPassword.substring(0, 20) + '...'); if (result.acknowledged) {
await client.close(); print("✅ User omriza5 created successfully with ID: " + userId);
} else {
print("❌ Failed to create user");
}
} }
' || echo "❌ Failed to execute MongoDB command"
createUser().catch(console.error);
" || echo "❌ Failed to create user with Node.js"
# Verify user was created # Verify user was created
echo "🔍 Verifying user creation..." echo "🔍 Verifying user creation..."