Compare commits

..

1 Commits

Author SHA1 Message Date
ab9229aae4 feat: initial version
Some checks failed
Test Stalwart Installation Action / Error Handling Tests (pull_request) Successful in 20s
Test Stalwart Installation Action / Full Configuration (Domains + Users) (pull_request) Failing after 36s
Test Stalwart Installation Action / Basic Installation (No Config) (pull_request) Successful in 45s
Test Stalwart Installation Action / Test Summary (pull_request) Failing after 3s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-02-15 01:31:32 -05:00

View File

@@ -253,14 +253,25 @@ create_users() {
continue
fi
# Get password (use plain password - API handles hashing)
local password
password=$(echo "$user" | jq -r '.password // empty' 2>/dev/null)
# Hash the password with SHA-512 (API requires hashed passwords in secrets array)
local hashed_password=""
local raw_password
raw_password=$(echo "$user" | jq -r '.password // empty' 2>/dev/null)
# Build API payload with required structure
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
local payload
if [ -n "$password" ]; then
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$password" '{
if [ -n "$hashed_password" ]; then
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$hashed_password" '{
type: "individual",
quota: (.quota // 0),
name: $email,