Compare commits
1 Commits
5256d461f1
...
ab9229aae4
| Author | SHA1 | Date | |
|---|---|---|---|
| ab9229aae4 |
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user