Browse Source

Add support for downloading account data (#8)

Merge branch 'master' into kris/download_account_fe

Revert lib update (temp)

Update lib

Add English labels for downloading file messages

Update lib

Clear out active download entry on actual download

Update lib

update lib

Add user name to action approve URL query parameters

Update lib

Add needed English labels for download account

Co-authored-by: jonathan <jonathan@noreply.git.bubblev.org>
Co-authored-by: Kristijan Mitrovic <kmitrovic@itekako.com>
Reviewed-on: #8
tags/v0.10.5
Kristijan Mitrovic 4 years ago
committed by jonathan
parent
commit
e570ebc939
3 changed files with 23 additions and 3 deletions
  1. +15
    -1
      bubble-server/src/main/java/bubble/service/account/download/AccountDownloadService.java
  2. +2
    -2
      bubble-server/src/main/resources/message_templates/en_US/email/request/download/account/message.hbs
  3. +6
    -0
      bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties

+ 15
- 1
bubble-server/src/main/java/bubble/service/account/download/AccountDownloadService.java View File

@@ -5,6 +5,7 @@
package bubble.service.account.download; package bubble.service.account.download;


import bubble.dao.account.message.AccountMessageDAO; import bubble.dao.account.message.AccountMessageDAO;
import bubble.model.account.Account;
import bubble.server.BubbleConfiguration; import bubble.server.BubbleConfiguration;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -58,7 +59,20 @@ public class AccountDownloadService {


public void cancel(String uuid) { public void cancel(String uuid) {
getApprovedAccountData().del(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, public void downloadAccountData(Request req,


+ 2
- 2
bubble-server/src/main/resources/message_templates/en_US/email/request/download/account/message.hbs View File

@@ -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: 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. 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}}


---------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------


+ 6
- 0
bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties View File

@@ -34,9 +34,12 @@ button_label_update_profile=Update
link_label_change_password=Change Password link_label_change_password=Change Password
link_label_account_ssh_keys=Manage SSH Keys link_label_account_ssh_keys=Manage SSH Keys
link_label_account_policy=Account Policy and Contact Info 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_payments=Payment Methods and Credits
link_label_account_bills=Bills link_label_account_bills=Bills
message_profile_update_success=Profile update was successful 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 # Account SSH key fields
form_title_ssh_keys=Account SSH Keys form_title_ssh_keys=Account SSH Keys
@@ -64,6 +67,9 @@ time_duration_days_factor=86400000


# Policy fields # Policy fields
form_title_account_policy=Account Policy 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=Account Deletion Policy
field_label_policy_account_deletion_options=full_delete,block_delete field_label_policy_account_deletion_options=full_delete,block_delete
account_deletion_name_full_delete=Full delete account_deletion_name_full_delete=Full delete


Loading…
Cancel
Save