diff --git a/bubble-server/src/main/java/bubble/service/account/download/AccountDownloadService.java b/bubble-server/src/main/java/bubble/service/account/download/AccountDownloadService.java index 7bc976b8..67e654ad 100644 --- a/bubble-server/src/main/java/bubble/service/account/download/AccountDownloadService.java +++ b/bubble-server/src/main/java/bubble/service/account/download/AccountDownloadService.java @@ -5,6 +5,7 @@ package bubble.service.account.download; import bubble.dao.account.message.AccountMessageDAO; +import bubble.model.account.Account; import bubble.server.BubbleConfiguration; import com.fasterxml.jackson.databind.JsonNode; import lombok.AllArgsConstructor; @@ -58,7 +59,20 @@ public class AccountDownloadService { public void cancel(String uuid) { getApprovedAccountData().del(uuid); - getAccountData().del(uuid); + + final var userDataString = getAccountData().get(uuid); + if (userDataString != null) { + getAccountData().del(uuid); + + final var userDataJson = json(userDataString, JsonNode.class); + Account account = null; + try { + account = json(userDataJson.get("Account").get(0).textValue(), Account.class); + } catch (Exception e) { + log.warn("cancel: cannot extract account UUID from account data for request: " + uuid); + } + if (account != null) { activeDownloads.remove(account.getUuid()); } + } } public void downloadAccountData(Request req, diff --git a/bubble-server/src/main/resources/message_templates/en_US/email/request/download/account/message.hbs b/bubble-server/src/main/resources/message_templates/en_US/email/request/download/account/message.hbs index 03ac3410..3f55a1f5 100644 --- a/bubble-server/src/main/resources/message_templates/en_US/email/request/download/account/message.hbs +++ b/bubble-server/src/main/resources/message_templates/en_US/email/request/download/account/message.hbs @@ -9,14 +9,14 @@ The request was made on {{format_epoch message.ctime 'MMM dd, YYYY' network.time If you did not make this request or would like to cancel this request, please click this link: - {{publicUri}}/action?deny={{confirmationToken}} + {{publicUri}}/action?deny={{confirmationToken}}&user={{account.name}} ---------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------- If you DID make this request and want to download your account data, click the link below. - {{publicUri}}/action?approve={{confirmationToken}} + {{publicUri}}/action?approve={{confirmationToken}}&user={{account.name}} ---------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------- diff --git a/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties b/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties index 54692fa4..d6c0d643 100644 --- a/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties +++ b/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties @@ -34,9 +34,12 @@ button_label_update_profile=Update link_label_change_password=Change Password link_label_account_ssh_keys=Manage SSH Keys link_label_account_policy=Account Policy and Contact Info +link_label_account_download=Request Account Data Download link_label_account_payments=Payment Methods and Credits link_label_account_bills=Bills message_profile_update_success=Profile update was successful +downloading_notice=File download will start promptly... +downloading_failed=File download failed. Please retry from the start # Account SSH key fields form_title_ssh_keys=Account SSH Keys @@ -64,6 +67,9 @@ time_duration_days_factor=86400000 # Policy fields form_title_account_policy=Account Policy +field_label_account_download=Account Data Download +button_label_account_download=Request Download +field_label_account_download_requested_notice=We have received your request. Check your email inbox for required data. field_label_policy_account_deletion=Account Deletion Policy field_label_policy_account_deletion_options=full_delete,block_delete account_deletion_name_full_delete=Full delete