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: |
|
run: |
|
||||||
echo "Testing user authentication via JMAP endpoint..."
|
echo "Testing user authentication via JMAP endpoint..."
|
||||||
|
|
||||||
# Test user1@test1.local authentication
|
# Test user1@test1.local authentication (show HTTP code for debugging)
|
||||||
JMAP_RESPONSE=$(curl -sf \
|
HTTP_CODE=$(curl -s -o /tmp/jmap_response.json -w "%{http_code}" \
|
||||||
-u "user1@test1.local:UserPass123!" \
|
-u "user1@test1.local:UserPass123!" \
|
||||||
"http://localhost:8080/.well-known/jmap")
|
"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
|
# 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
|
if [ "$USERNAME" = "user1@test1.local" ]; then
|
||||||
echo "✓ User authentication successful: $USERNAME"
|
echo "✓ User authentication successful: $USERNAME"
|
||||||
@@ -184,7 +191,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify accounts object is not empty (means user is authenticated)
|
# 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
|
if [ "$ACCOUNTS" != "{}" ]; then
|
||||||
echo "✓ User has active accounts"
|
echo "✓ User has active accounts"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -253,25 +253,14 @@ create_users() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Hash the password if provided
|
# Get password (use plain password - API handles hashing)
|
||||||
local hashed_password=""
|
local password
|
||||||
local raw_password
|
password=$(echo "$user" | jq -r '.password // empty' 2>/dev/null)
|
||||||
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
|
|
||||||
|
|
||||||
# Build API payload with required structure
|
# Build API payload with required structure
|
||||||
local payload
|
local payload
|
||||||
if [ -n "$hashed_password" ]; then
|
if [ -n "$password" ]; then
|
||||||
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$hashed_password" '{
|
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$password" '{
|
||||||
type: "individual",
|
type: "individual",
|
||||||
quota: (.quota // 0),
|
quota: (.quota // 0),
|
||||||
name: $email,
|
name: $email,
|
||||||
|
|||||||
Reference in New Issue
Block a user