diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a916e43ad..e2dfc848b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,6 +81,7 @@ Here is an example file with the various options explained: { "ApiUrl": "http://localhost:5092", "PrivateEmailDomains": ["example.tld"], + "SupportEmail": "support@example.tld", "UseDebugEncryptionKey": "true", "CryptographyOverrideType" : "Argon2Id", "CryptographyOverrideSettings" : "{\"DegreeOfParallelism\":1,\"MemorySize\":1024,\"Iterations\":1}" diff --git a/install.sh b/install.sh index eb9bc6566..955097506 100755 --- a/install.sh +++ b/install.sh @@ -245,6 +245,30 @@ set_smtp_tls_enabled() { fi } +# Function to ask for support email +set_support_email() { + printf "${CYAN}> Setting SUPPORT_EMAIL...${NC}\n" + if ! grep -q "^SUPPORT_EMAIL=" "$ENV_FILE"; then + printf "Please enter the support email address that users can contact for issues accessing their vault (press Enter to disable): " + read -r support_email + + echo "SUPPORT_EMAIL=${support_email}" >> "$ENV_FILE" + + if [ -z "$support_email" ]; then + printf "${GREEN}> SUPPORT_EMAIL has been left empty in $ENV_FILE.${NC}\n" + else + printf "${GREEN}> SUPPORT_EMAIL has been set to '${support_email}' in $ENV_FILE.${NC}\n" + fi + else + support_email=$(grep "^SUPPORT_EMAIL=" "$ENV_FILE" | cut -d '=' -f2) + if [ -z "$support_email" ]; then + printf "${GREEN}> SUPPORT_EMAIL already exists in $ENV_FILE but is empty.${NC}\n" + else + printf "${GREEN}> SUPPORT_EMAIL already exists in $ENV_FILE with value: ${support_email}${NC}\n" + fi + fi +} + # Function to build and run the Docker Compose stack with muted output unless an error occurs, showing progress indication build_and_run_docker_compose() { printf "${CYAN}> Building Docker Compose stack..." @@ -340,6 +364,7 @@ main() { populate_data_protection_cert_pass || exit $? set_private_email_domains || exit $? set_smtp_tls_enabled || exit $? + set_support_email || exit $? generate_admin_password || exit $? printf "\n${YELLOW}+++ Building Docker containers +++${NC}\n" printf "\n" diff --git a/src/AliasVault.Client/Auth/Pages/ForgotPassword.razor b/src/AliasVault.Client/Auth/Pages/ForgotPassword.razor index f7df4611a..ae72f2e46 100644 --- a/src/AliasVault.Client/Auth/Pages/ForgotPassword.razor +++ b/src/AliasVault.Client/Auth/Pages/ForgotPassword.razor @@ -1,6 +1,7 @@ @page "/user/forgot-password" @attribute [AllowAnonymous] @layout Auth.Layout.MainLayout +@inject Config Config

Lost password @@ -14,7 +15,14 @@

Recently changed password

- If you've recently changed your password and are experiencing difficulties signing in with your new password, please note that the server administrator may be able to recover an earlier backup of your vault to assist you. - If this is the case, please contact the server administrator. + @if (!string.IsNullOrEmpty(Config.SupportEmail)) + { +

If you've recently changed your password and are experiencing difficulties signing in, please contact support at @Config.SupportEmail for assistance.

+ } + else + { +

If you've recently changed your password and are experiencing difficulties signing in with your new password, please note that the server administrator may be able to recover an earlier backup of your vault to assist you. + If this is the case, please contact the server administrator.

+ }
diff --git a/src/AliasVault.Client/Config.cs b/src/AliasVault.Client/Config.cs index b8a057415..1295bd48e 100644 --- a/src/AliasVault.Client/Config.cs +++ b/src/AliasVault.Client/Config.cs @@ -57,4 +57,9 @@ public class Config /// For Argon2Id, this includes DegreeOfParallelism, MemorySize, and Iterations. /// public string? CryptographyOverrideSettings { get; set; } + + /// + /// Gets or sets the support email address that users can contact for password recovery. + /// + public string? SupportEmail { get; set; } } diff --git a/src/AliasVault.Client/Dockerfile b/src/AliasVault.Client/Dockerfile index 9c8c3e03f..5d91f479b 100644 --- a/src/AliasVault.Client/Dockerfile +++ b/src/AliasVault.Client/Dockerfile @@ -3,6 +3,9 @@ WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release +# Add environment variable for opting out of telemetry which fixes +# "error MSB4166: Child node "8" exited prematurely." issues. +ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 WORKDIR /src # Install Python which is required by the WebAssembly tools diff --git a/src/AliasVault.Client/entrypoint.sh b/src/AliasVault.Client/entrypoint.sh index 234f20e04..6549e5ffb 100755 --- a/src/AliasVault.Client/entrypoint.sh +++ b/src/AliasVault.Client/entrypoint.sh @@ -2,10 +2,12 @@ # Set the default API URL for localhost debugging DEFAULT_API_URL="http://localhost:81" DEFAULT_PRIVATE_EMAIL_DOMAINS="localmail.tld" +DEFAULT_SUPPORT_EMAIL="" # Use the provided API_URL environment variable if it exists, otherwise use the default API_URL=${API_URL:-$DEFAULT_API_URL} PRIVATE_EMAIL_DOMAINS=${PRIVATE_EMAIL_DOMAINS:-$DEFAULT_PRIVATE_EMAIL_DOMAINS} +SUPPORT_EMAIL=${SUPPORT_EMAIL:-$DEFAULT_SUPPORT_EMAIL} # Replace the default URL with the actual API URL sed -i "s|http://localhost:5092|${API_URL}|g" /usr/share/nginx/html/appsettings.json @@ -19,6 +21,12 @@ json_array=$(echo $PRIVATE_EMAIL_DOMAINS | awk '{split($0,a,","); printf "["; fo # Use sed to update the PrivateEmailDomains field in appsettings.json sed -i.bak "s|\"PrivateEmailDomains\": \[.*\]|\"PrivateEmailDomains\": $json_array|" /usr/share/nginx/html/appsettings.json +# Update support email in appsettings.json +if [ ! -z "$SUPPORT_EMAIL" ]; then + sed -i "s|\"SupportEmail\": \".*\"|\"SupportEmail\": \"$SUPPORT_EMAIL\"|g" /usr/share/nginx/html/appsettings.json +else + sed -i "s|\"SupportEmail\": \".*\"|\"SupportEmail\": \"\"|g" /usr/share/nginx/html/appsettings.json +fi + # Start the application nginx -g "daemon off;" - diff --git a/src/AliasVault.Client/wwwroot/appsettings.json b/src/AliasVault.Client/wwwroot/appsettings.json index db97a6326..83bc6ece5 100644 --- a/src/AliasVault.Client/wwwroot/appsettings.json +++ b/src/AliasVault.Client/wwwroot/appsettings.json @@ -1,4 +1,5 @@ { "ApiUrl": "http://localhost:5092", - "PrivateEmailDomains": ["example.tld"] + "PrivateEmailDomains": ["example.tld"], + "SupportEmail": "support@example.tld" }