Compare commits
1 Commits
057cafab61
...
306ab9af90
| Author | SHA1 | Date | |
|---|---|---|---|
| 306ab9af90 |
@@ -19,9 +19,12 @@ readonly RETRY_DELAY=2
|
||||
# Read the generated password from installation
|
||||
DEFAULT_ADMIN_PASSWORD="changeme"
|
||||
if [ -f "${STALWART_PATH}/.init_password" ]; then
|
||||
DEFAULT_ADMIN_PASSWORD=$(cat "${STALWART_PATH}/.init_password")
|
||||
DEFAULT_ADMIN_PASSWORD=$(cat "${STALWART_PATH}/.init_password" | tr -d '\n\r')
|
||||
log_info "Using generated password from installation"
|
||||
# Clean up the password file for security
|
||||
rm -f "${STALWART_PATH}/.init_password"
|
||||
else
|
||||
log_warning "Password file not found, using default password"
|
||||
fi
|
||||
readonly DEFAULT_ADMIN_PASSWORD
|
||||
|
||||
|
||||
@@ -123,12 +123,15 @@ main() {
|
||||
# Extract the generated password from output
|
||||
# Output format: "🔑 Your administrator account is 'admin' with password 'XXXXX'."
|
||||
local _generated_password
|
||||
_generated_password=$(echo "$_init_output" | grep -oP "with password '\K[^']+" || echo "")
|
||||
_generated_password=$(echo "$_init_output" | sed -n "s/.*with password '\([^']*\)'.*/\1/p")
|
||||
|
||||
# Save the generated password for configure.sh to use
|
||||
if [ -n "$_generated_password" ]; then
|
||||
say "📝 Saving generated password for configuration..."
|
||||
echo "$_generated_password" > "$_dir/.init_password"
|
||||
chmod 600 "$_dir/.init_password"
|
||||
chmod 644 "$_dir/.init_password"
|
||||
else
|
||||
say "⚠️ Warning: Could not extract generated password"
|
||||
fi
|
||||
|
||||
# Set permissions
|
||||
|
||||
Reference in New Issue
Block a user