This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
/
close.spt
164 lines (127 loc) · 6.1 KB
/
close.spt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
from gratipay.utils import get_participant
[---]
participant = get_participant(request, restrict=True)
title = _("Close Account")
subhead = participant.username
payday_is_running = website.db.one("""
SELECT ts_start FROM paydays WHERE ts_end='1970-01-01T00:00:00+00'::timestamptz
""") is not None
if POST:
if payday_is_running:
pass # User will get the "Try Again Later" message.
else:
disbursement_strategy = request.body.get('disbursement_strategy')
if participant.balance and disbursement_strategy is None:
error = _("You still have money in this Gratipay account, please "
"choose a disbursement method below or contact support.")
else:
try:
participant.close(disbursement_strategy)
except participant.BankWithdrawalFailed as e:
error = _("The bank withdrawal failed. Error message: {0}", e)
else:
request.redirect('/%s/' % participant.username)
[---] text/html
{% extends "templates/base.html" %}
{% block content %}
<div class="col0">
{% if payday_is_running %}
<form><div class="constrain-width clearfix">
<h2>Try Again Later</h2>
<p>Sorry, we're running payday right now, and we're not set up
to close accounts while payday is running. Please check back in
a few hours.</p>
</div></form>
{% else %}
<form method="POST">
<div class="constrain-width clearfix">
{% if participant.balance > 0 %}
<h2 class="first">Balance</h2>
<p>You have a balance of <b>${{ participant.balance }}</b>.<br>
What should we do with it?</p>
<ul>
{% if participant.last_ach_result == '' %}
{% if participant.is_whitelisted %}
<li><input type="radio" name="disbursement_strategy" id="r1"
value="bank" checked />
<label for="r1">Send it to my <a href="/bank-account.html">bank
account</a></label></li>
{% else %}
<li><label>A staff member will review your account
by Thursday, and then you'll be able to have your
funds deposited to your bank account on file. To
expedite the review, please <a
href="mailto:[email protected]?subject=review%20for%20closing%20account">contact
support</a>.</label></li>
{% endif %}
{% else %}
<li><label>Go <a href="/bank-account.html">set up a bank
account</a> to be able to have your funds deposited there.
Due to our anti-fraud policies, a staff member will need to
review your account before completing the
transaction using this option.</label></li>
{% endif %}
{% if participant.giving %}
<li><input type="radio" name="disbursement_strategy" id="r2"
value="downstream" />
<label for="r2">Give it to the <a href="../giving/">people I
tip</a></label></li>
{% else %}
<li><label>Go <a href="/">set up some tips</a> to be able to distribute your
balance as a final gift.</label></li>
{% endif %}
</ul>
<p>If neither option works for you, please <a
href="mailto:[email protected]?subject=close%20account">contact
support</a> to otherwise deal with your balance before
closing your account.</p>
{% endif %}
<h2>Personal Information</h2>
<p>We immediately clear out most of the information in your
profile (though it may still exist in our database in event
logs, to be fully deleted once we sort out our <a
href="https://github.com/gratipay/gratipay.com/issues/397">data
retention policy</a>).</p>
<p>Things we clear immediately include your profile statement,
any funding goal, the tips you're receiving, and those you're
giving. You'll also be removed from any communities and teams
you were a part of. If you're closing a team account, all team
members will be removed from the team.</p>
<p>We specifically <i>don't</i> delete your past giving and
receiving history on the site, because that information also
belongs equally to other users (the ones you gave to and
received from).</p>
<p>After you close your account, your profile page will say,
“The account owner has closed this account.”</p>
<h2>Username</h2>
<p>We may give your username to someone else if they ask for
it, but not for at least a year after you close your account
(unless we determine that you've been infringing a
trademark).</p>
<p>Until we give your username to someone else, you can use it
again if you ever decide to rejoin Gratipay. Simply sign in.</p>
<h2>Remember</h2>
<p>We have no control over links to your profile from other
places on the Internet.</p>
<p>We have no control over content indexed by search engines
like Google.</p>
<h2>Ready?</h2>
</div>
<div class="nav level-1">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="selected larger close-account" id="save"
type="submit">Yes, Close My Gratipay Account</button>
</div>
</form>
{% endif %}
</div>
{% endblock %}
{% block scripts %}
{% if error %}
<script>
$(function () {
Gratipay.notification("{{ error.replace('"', '\\"') }}", 'error', -1)
});
</script>
{% endif %}
{% endblock %}