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