Compare commits

..

1 Commits

Author SHA1 Message Date
5256d461f1 feat: initial version
Some checks failed
Test Stalwart Installation Action / Error Handling Tests (pull_request) Successful in 18s
Test Stalwart Installation Action / Basic Installation (No Config) (pull_request) Successful in 44s
Test Stalwart Installation Action / Full Configuration (Domains + Users) (pull_request) Failing after 44s
Test Stalwart Installation Action / Test Summary (pull_request) Failing after 3s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-02-15 01:28:40 -05:00
2 changed files with 17 additions and 21 deletions

View File

@@ -166,15 +166,22 @@ jobs:
run: |
echo "Testing user authentication via JMAP endpoint..."
# Test user1@test1.local authentication
JMAP_RESPONSE=$(curl -sf \
# Test user1@test1.local authentication (show HTTP code for debugging)
HTTP_CODE=$(curl -s -o /tmp/jmap_response.json -w "%{http_code}" \
-u "user1@test1.local:UserPass123!" \
"http://localhost:8080/.well-known/jmap")
echo "JMAP Response: $JMAP_RESPONSE"
echo "HTTP Status Code: $HTTP_CODE"
echo "JMAP Response:"
cat /tmp/jmap_response.json | jq '.' || cat /tmp/jmap_response.json
if [ "$HTTP_CODE" != "200" ]; then
echo "::error::JMAP endpoint returned HTTP $HTTP_CODE"
exit 1
fi
# Verify username field contains our test user
USERNAME=$(echo "$JMAP_RESPONSE" | jq -r '.username // empty')
USERNAME=$(cat /tmp/jmap_response.json | jq -r '.username // empty')
if [ "$USERNAME" = "user1@test1.local" ]; then
echo "✓ User authentication successful: $USERNAME"
@@ -184,7 +191,7 @@ jobs:
fi
# Verify accounts object is not empty (means user is authenticated)
ACCOUNTS=$(echo "$JMAP_RESPONSE" | jq '.accounts // {}')
ACCOUNTS=$(cat /tmp/jmap_response.json | jq '.accounts // {}')
if [ "$ACCOUNTS" != "{}" ]; then
echo "✓ User has active accounts"
else

View File

@@ -253,25 +253,14 @@ create_users() {
continue
fi
# Hash the password if provided
local hashed_password=""
local raw_password
raw_password=$(echo "$user" | jq -r '.password // empty' 2>/dev/null)
if [ -n "$raw_password" ]; then
if command -v mkpasswd >/dev/null 2>&1; then
hashed_password=$(mkpasswd -m sha-512 "$raw_password")
elif command -v openssl >/dev/null 2>&1; then
hashed_password=$(openssl passwd -6 "$raw_password")
else
log_warning "Cannot hash password for $email - no mkpasswd or openssl found"
fi
fi
# Get password (use plain password - API handles hashing)
local password
password=$(echo "$user" | jq -r '.password // empty' 2>/dev/null)
# Build API payload with required structure
local payload
if [ -n "$hashed_password" ]; then
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$hashed_password" '{
if [ -n "$password" ]; then
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$password" '{
type: "individual",
quota: (.quota // 0),
name: $email,