fix: request for account deletion flow

This commit is contained in:
Jannat Patel 2021-12-01 10:54:15 +05:30
parent ed916090b8
commit d622b96e64
7 changed files with 66 additions and 11 deletions

View file

@ -0,0 +1,3 @@
<p>{{_("Dear User,")}}</p>
<p>{{_("As per your request, your account and data on {0} associated with email {1} has been permanently deleted").format(app_name, email)}}.</p>

View file

@ -75,7 +75,7 @@ class PersonalDataDeletionRequest(Document):
frappe.sendmail(
recipients=self.email,
subject=_("Confirm Deletion of Data"),
subject=_("Confirm Deletion of Account"),
template="delete_data_confirmation",
args={
"email": self.email,
@ -83,7 +83,7 @@ class PersonalDataDeletionRequest(Document):
"host_name": frappe.local.site,
"link": url,
},
header=[_("Confirm Deletion of Data"), "green"],
header=[_("Confirm Deletion of Account"), "green"],
)
def notify_system_managers(self):
@ -109,6 +109,7 @@ class PersonalDataDeletionRequest(Document):
self.validate_data_anonymization()
self.disable_user()
self.anonymize_data()
self.notify_user_after_deletion()
def anonymize_data(self):
return frappe.enqueue_doc(
@ -120,6 +121,18 @@ class PersonalDataDeletionRequest(Document):
now=frappe.flags.in_test,
)
def notify_user_after_deletion(self):
frappe.sendmail(
recipients=self.email,
subject=_("Your account has been deleted"),
template="account_deletion_notification",
args={
"email": self.email,
"app_name": frappe.db.get_single_value("Website Settings", "app_name"),
},
header=[_("Your account has been deleted"), "green"],
)
def add_deletion_steps(self):
if self.deletion_steps:
return

View file

@ -63,7 +63,10 @@
"subdomain",
"head_html",
"robots_txt",
"route_redirects"
"route_redirects",
"account_deletion_settings_section",
"show_account_deletion_link",
"account_deletion_sla"
],
"fields": [
{
@ -386,6 +389,22 @@
"fieldname": "app_logo",
"fieldtype": "Attach Image",
"label": "App Logo"
},
{
"fieldname": "account_deletion_settings_section",
"fieldtype": "Section Break",
"label": "Account Deletion Settings"
},
{
"fieldname": "account_deletion_sla",
"fieldtype": "Int",
"label": "Account Deletion SLA (Days)"
},
{
"default": "0",
"fieldname": "show_account_deletion_link",
"fieldtype": "Check",
"label": "Show Account Deletion Link in My Account Page"
}
],
"icon": "fa fa-cog",
@ -394,7 +413,7 @@
"issingle": 1,
"links": [],
"max_attachments": 10,
"modified": "2021-08-23 21:39:51.702248",
"modified": "2021-12-01 10:15:17.403155",
"modified_by": "Administrator",
"module": "Website",
"name": "Website Settings",
@ -418,4 +437,4 @@
"sort_field": "modified",
"sort_order": "ASC",
"track_changes": 1
}
}

View file

@ -177,3 +177,7 @@ def get_items(parentfield):
t['child_items'].append(d)
break
return top_items
@frappe.whitelist(allow_guest=True)
def get_account_deletion_sla():
return frappe.db.get_single_value("Website Settings", "account_deletion_sla")

View file

@ -1,3 +1,14 @@
frappe.ready(function() {
// bind events here
});
frappe.web_form.after_load = () => {
frappe.call({
method: "frappe.website.doctype.website_settings.website_settings.get_account_deletion_sla",
callback: (data) => {
if (data.message) {
const intro_wrapper = $('#introduction .ql-editor.read-mode');
const sla_description = `<br><b>Note: Your request for account deletion will be fulfilled within ${data.message} days.</b>`;
intro_wrapper.html(intro_wrapper.html() + sla_description);
}
}
})
}
});

View file

@ -10,24 +10,26 @@
"amount_based_on_field": 0,
"apply_document_permissions": 0,
"button_label": "Submit",
"client_script": "",
"creation": "2019-01-25 14:24:12.588810",
"currency": "INR",
"custom_css": "[data-doctype=\"Web Form\"] {\n width: 50%;\n margin: 6rem auto;\n}",
"doc_type": "Personal Data Deletion Request",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"introduction_text": "<div class=\"ql-editor read-mode\"><p>Send a request to delete your personally identifiable information (PII) that is stored on our system. You will receive an email to verify your request. Once the request is verified we will take care of deleting your PII. If you just want to check what PII we have stored, you can <a href=\"/request-data\" rel=\"noopener noreferrer\">request your data</a>.</p></div>",
"introduction_text": "<div class=\"ql-editor read-mode\"><p>Send a request to delete your account and personally identifiable information (PII) that is stored on our system. You will receive an email to verify your request. Once the request is verified we will take care of deleting your PII. If you just want to check what PII we have stored, you can <a href=\"/request-data\" rel=\"noopener noreferrer\">request your data</a>.</p></div>",
"is_standard": 1,
"login_required": 0,
"max_attachment_size": 0,
"modified": "2021-03-25 11:08:49.580621",
"modified": "2021-11-30 17:56:03.099870",
"modified_by": "Administrator",
"module": "Website",
"name": "request-to-delete-data",
"owner": "Administrator",
"payment_button_label": "Buy Now",
"published": 1,
"route": "request-to-delete-data",
"route": "request-for-account-deletion",
"route_to_success_link": 0,
"show_attachments": 0,
"show_in_grid": 0,
@ -35,7 +37,7 @@
"sidebar_items": [],
"success_message": "An email to verify your request has been sent to your email address. Please verify your request to complete the process.",
"success_url": "/",
"title": "Request to Delete Data",
"title": "Request for Account Deletion",
"web_form_fields": [
{
"allow_read_on_all_link_options": 0,

View file

@ -10,6 +10,9 @@
<li><a href="/update-password">{{ _("Reset Password") }}</a></li>
<li><a href="/update-profile?name={{ user }}">{{ _("Edit Profile") }}</a></li>
<li><a href="/third_party_apps">{{ _("Manage Third Party Apps") }}</a></li>
{% if frappe.db.get_single_value("Website Settings", "show_account_deletion_link") %}
<li><a href="/request-for-account-deletion?new=1">{{ _("Request for Account Deletion") }}</a></li>
{% endif %}
</ul>
</div>
</div>