docbrown/app/views/users/confirm_destroy.html.erb
Ridhwana b9a8d87e95
[deploy] Refactor to create a helper for the mailer links (#7502)
* refactor: set the email_from to use in teh defaults

* chore: remove some new lines

* feat: add a mail link helper that can be used in the views

* feat: returns the default if it doesn't understand the parameter

* feat: Quick replacement of links

* feat: allow subject to be passed through

* chore: update all hrefs

* chore: remove rel attribute

* chore: mail link

* update spec

* chore: space

* chore: update some whitespaces and emails

* style

* chore: PR mail_link to email_link and the comment

* feat: PR suggestions for encoding

* feat: use mail_to
2020-04-27 09:18:16 -04:00

55 lines
2.8 KiB
Text

<div class="user-settings-page">
<h2> Destroy your account</h2>
<div class="settings-form">
<h4 style="font-weight:400;">
<%= form_tag user_full_delete_path, method: :delete, autocomplete: "off", id: "delete__account" do %>
Deleting your account will:
<ul class="delete__account">
<li>delete your profile, along with your Twitter and/or GitHub associations.
This does not include app permissions. You will have to remove them yourself on
<a href="https://twitter.com/settings/applications">Twitter profile settings</a> and
<a href="https://github.com/settings/applications">GitHub profile settings</a>.
</li>
<%# TODO: expand the delete messaging later %>
<li>delete any and all content you have, such as articles, comments, your reading list or chat messages.</li>
<li>allow your username to become available to anyone.</li>
</ul>
<div class="field">
<label for="delete__account__username__field">
<b>To delete your account, type in your username:</b>
</label>
<input type="text" name="delete__account__username__field" id="delete__account__username__field">
</div>
<div class="field">
<label for="delete__account__verification__field">
<b>For verification, type the words:</b><i> delete my account</i>
</label>
<input type="text" name="delete__account__verification__field" id="delete__account__verification__field">
</div>
<button class="big-action danger-button small-button" id="delete__account__btn" type="submit" disabled="true">
DELETE ACCOUNT
</button>
<% end %>
</h4>
<br>
<script>
const deleteAccountBtn = document.getElementById('delete__account__btn');
const deleteAccountUsernameInput = document.getElementById('delete__account__username__field');
const deleteAcccountVerificationInput = document.getElementById('delete__account__verification__field');
function bothInputsVerified() {
return deleteAccountUsernameInput.value === '<%= @user.username %>' && deleteAcccountVerificationInput.value === "delete my account";
}
const disableDeleteAccountBtn = () => { deleteAccountBtn.disabled = !bothInputsVerified() };
deleteAccountUsernameInput.addEventListener('input', disableDeleteAccountBtn);
deleteAcccountVerificationInput.addEventListener('input', disableDeleteAccountBtn);
</script>
<p>
If you would like to keep your content under the <%= link_to "@ghost", "/ghost" %> account,
please <%= email_link(text: "click here", additional_info: { subject: "Request Account Deletion", body: @email_body }) %>
</p>
<p>
Feel free to contact <%= email_link %> with any questions.
</p>
</div>
</div>