PHRAS-1972: Account Page, Allow a Phraseanet User to delete his account and associated datas (#2918)

* allow user to delete account

* generate translation and add checkbox in the windows confirmation

* change text an configuration key

* update delete account fonctionality

* rename variable

* write in explicite condition

* merge yarn.lock

* regenerate translation
This commit is contained in:
aynsix
2019-04-08 16:25:17 +04:00
committed by jygaulier
parent 4bb3e28bf5
commit 5cdf473c7f
27 changed files with 1258 additions and 304 deletions

View File

@@ -232,12 +232,93 @@
</div>
</div>
<div class="well well-large" style="border: 1px solid #333333;">
<div style="max-width: 400px;margin-left: 52px">
<div style="max-width: 400px;margin-left: 2%;display: inline-block;width: 47%;margin-right: 1%;">
<input type="submit" class="btn btn-info btn-block btn-large" value="{{ 'boutton::valider' | trans }}"/>
</div>
<div style="max-width: 400px;margin-left: 1%;width: 47%;display: inline-block;margin-right: 2%;float: right;">
{% if not user.isadmin() and not user.hasLdapCreated() and (owned_feeds|length == 0) and (initiated_validations|length == 0) %}
<a href="#delete-account-process" type="button" role="button" data-toggle="modal" class="btn btn-danger btn-block btn-large">{{ 'phraseanet::account: Delete my account' | trans }}</a>
<!-- Modal -->
<div id="delete-account-process" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">{{ "phraseanet::account: Process to delete account" }}</h3>
</div>
<div class="modal-body">
<p>{{ "phraseanet::account: Are you sure you want to delete your account?" | trans }} </p>
<h6>{{ "phraseanet::account: List of data to be deleted" | trans }}</h6>
{% if baskets|length > 0 %}
- {{ 'Paniers' | trans }}
<ul style="padding-left: 30px">
{% for basket in baskets %}
<li>{{ basket.getName() }}</li>
{% endfor %}
</ul>
{% endif %}
{% if api_accounts|length > 0 %}
- {{ "My application " | trans }}
<ul style="padding-left: 30px">
{% for api_account in api_accounts %}
<li>{{ api_account.getApplication().getName() ~ " => Client_id: " ~ api_account.getApplication().getClientId() }}</li>
{% endfor %}
</ul>
{% endif%}
- {{ "phraseanet::account: My phraseanet account" | trans }}
<ul style="padding-left: 30px">
<li>Name : {{ user.getFirstName() ~ ' ' ~ user.getLastName() }}</li>
<li>Login : {{ user.getLogin() }}</li>
</ul>
</div>
<div class="modal-footer">
<label style="text-align: left;" class="form_label checkbox" for="delete_account_aggree">
{% if app['conf'].get(['main', 'delete-account-require-email-confirmation']) %}
{{ "phraseanet::account: I am agree to delete my account, need confirmation on mail" | trans }}
{% else %}
{{ "phraseanet::account: I am agree to delete my account" | trans }}
{% endif %}
<input class="input_element input-xlarge" type="checkbox" id="delete_account_aggree"/>
</label>
<button class="btn" data-dismiss="modal" aria-hidden="true">{{ "No" | trans }}</button>
<a id="delete_account_confirm" class="btn btn-info" style="opacity:0.5;pointer-events: none;" >{{ "Yes" | trans }}</a>
</div>
</div>
{% else %}
<p style="font-size: 12px"> {{ "phraseanet::account: << your account can be deleted via admin interface >> " | trans }}</p>
{% endif %}
</div>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var deleteButton = $("#delete_account_confirm");
$("#delete_account_aggree").bind("click", function(e) {
if ($(this).is(":checked")) {
deleteButton.attr("href", '{{ path("account_process_delete") }}');
deleteButton.css({"opacity": "1", "pointer-events": "auto"});
} else {
deleteButton.removeAttr("href");
deleteButton.css({"opacity": "0.5", "pointer-events": "none"});
}
});
});
</script>
{% endblock %}

View File

@@ -49,7 +49,13 @@
<!-- End of header table -->
<!-- Subject table -->
<table width="90%" cellpadding="0" cellspacing="0" border="0" align="center" style="width:90% !important;">
<tr style="background-color:#a6aab0">
<tr style=
{% if mailSkin == constant('Alchemy\\Phrasea\\Notification\\Mail\\MailRequestAccountDelete::MAIL_SKIN') %}
"background: linear-gradient(to bottom, #ee5f5b, #bd362f)"
{% elseif mailSkin == constant('Alchemy\\Phrasea\\Notification\\Mail\\AbstractMail::MAIL_SKIN') %}
"background-color:#a6aab0"
{% endif %}
>
<td height="50" valign="center" align="center" style="font-family: Helvetica, Tahoma, Arial, sans-serif; font-size:16px; line-height:19px; font-weight:bold; color:#ffffff;">
{{ subject }}
</td>
@@ -72,7 +78,7 @@
<span style="color:#FFA500; color:#FFA500 !important; text-decoration:underline; cursor:pointer;">{{ senderMail }}</span></a><br/>
{% endif %}
<br/>
{{ messageText | nl2br }}
{{ messageText | raw | nl2br }}
<br/>
</td>
</tr>