Compare commits
1 Commits
5256d461f1
...
ab9229aae4
| Author | SHA1 | Date | |
|---|---|---|---|
| ab9229aae4 |
@@ -253,14 +253,25 @@ create_users() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get password (use plain password - API handles hashing)
|
# Hash the password with SHA-512 (API requires hashed passwords in secrets array)
|
||||||
local password
|
local hashed_password=""
|
||||||
password=$(echo "$user" | jq -r '.password // empty' 2>/dev/null)
|
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
|
local payload
|
||||||
if [ -n "$password" ]; then
|
if [ -n "$hashed_password" ]; then
|
||||||
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$password" '{
|
payload=$(echo "$user" | jq --arg email "$email" --arg pwd "$hashed_password" '{
|
||||||
type: "individual",
|
type: "individual",
|
||||||
quota: (.quota // 0),
|
quota: (.quota // 0),
|
||||||
name: $email,
|
name: $email,
|
||||||
|
|||||||
Reference in New Issue
Block a user