Compare commits

..

1 Commits

Author SHA1 Message Date
b89d0f5aa1 feat: initial version
Some checks failed
Test Stalwart Installation Action / Installation with Admin Password (pull_request) Failing after 22s
Test Stalwart Installation Action / Full Configuration (Domains + Users) (pull_request) Failing after 25s
Test Stalwart Installation Action / Error Handling Tests (pull_request) Successful in 27s
Test Stalwart Installation Action / Basic Installation (No Config) (pull_request) Successful in 47s
Test Stalwart Installation Action / Test on Ubuntu ubuntu-20.04 (pull_request) Has been cancelled
Test Stalwart Installation Action / Test on Ubuntu ubuntu-22.04 (pull_request) Has been cancelled
Test Stalwart Installation Action / Test on Ubuntu ubuntu-24.04 (pull_request) Has been cancelled
Test Stalwart Installation Action / Test Summary (pull_request) Has been cancelled
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-02-14 23:54:56 -05:00

View File

@@ -141,16 +141,27 @@ authenticate() {
local response
local token
local http_code
response=$(curl -sf -X POST "${API_URL}/authenticate" \
# Try authentication with "account" field (Stalwart uses "account" not "login")
response=$(curl -s -w "\n%{http_code}" -X POST "${API_URL}/authenticate" \
-H "Content-Type: application/json" \
-d "{\"login\":\"admin\",\"password\":\"${password}\"}" 2>&1) || {
return 1
}
-d "{\"account\":\"admin\",\"password\":\"${password}\"}" 2>&1)
token=$(echo "$response" | jq -r '.token // empty' 2>/dev/null)
http_code=$(echo "$response" | tail -n 1)
response=$(echo "$response" | sed '$d')
if [ "$http_code" != "200" ]; then
log_error "Authentication failed with HTTP $http_code"
log_error "Response: $response"
return 1
fi
token=$(echo "$response" | jq -r '.data // empty' 2>/dev/null)
if [ -z "$token" ]; then
log_error "No token in response"
log_error "Response: $response"
return 1
fi