Compare commits
1 Commits
889425764c
...
5256d461f1
| Author | SHA1 | Date | |
|---|---|---|---|
| 5256d461f1 |
17
.github/workflows/test.yml
vendored
17
.github/workflows/test.yml
vendored
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user