forked from liberapay/liberapay.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm.html.spt
113 lines (95 loc) · 4.36 KB
/
confirm.html.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
from liberapay.models.account_elsewhere import AccountElsewhere
from liberapay.models.participant import Participant
[--------]
user.require_write_permission()
account_id, p_id = request.qs.get_int('id'), request.qs.get_int('p_id', None)
account = AccountElsewhere.from_id(account_id, _raise=False)
if not account:
raise response.invalid_input(account_id, 'id', 'querystring')
cookie_name = 'connect_%s' % account_id
token = request.headers.cookie.get(cookie_name)
if not token or not account.check_connect_token(token.value):
raise response.invalid_input(token, cookie_name, 'cookies')
p = Participant.from_id(p_id, _raise=False) if p_id else user
if not p:
raise response.invalid_input(p_id, 'p_id', 'querystring')
other = account.participant
user_accounts = p.get_accounts_elsewhere()
other_accounts = other.get_accounts_elsewhere()
title = _("Please Confirm")
[--------]
% from 'templates/macros/elsewhere.html' import platform_icon_small
% extends "templates/layouts/base.html"
% block content
<div class="on-confirm">
<p>{{ platform_icon_small(account.platform_data) }}
{{ _("{0} is connected to {1} on Liberapay. Transfer it?",
'<span class="highlight">%s</span>'|safe % account.friendly_name,
('<a href="/{0}/">{0}</a>'|safe).format(other.username)) }}
</p>
<h4>{{ _("How the accounts are now") }}</h4>
<div class="row">
<div class="col-sm-4">
<b>{{ p.username }}</b><br />
% for account in user_accounts
{{ platform_icon_small(account.platform_data) }}
<span class="sr-only">{{ account.platform_data.display_name }}:</span>
{{ account.friendly_name }}<br />
% else
<p class="text-muted">{{ _("No connected accounts.") }}</p>
% endfor
</div>
<div class="col-sm-4 other">
<b>{{ other.username }}</b><br />
% for other_account in other_accounts
{{ platform_icon_small(other_account.platform_data) }}
<span class="sr-only">{{ other_account.platform_data.display_name }}:</span>
<span class="{{ 'highlight' if other_account.platform == account.platform else '' }}">{{
other_account.friendly_name
}}</span><br />
% endfor
</div>
</div>
<h4>{{ _("How the accounts will be after the transfer") }}</h4>
<div class="row">
<div class="col-sm-4">
<b>{{ p.username }}</b><br />
% for user_account in user_accounts
<span class="account-elsewhere">
{{ platform_icon_small(user_account.platform_data) }}
<span class="sr-only">{{ user_account.platform_data.display_name }}:</span>
{{ user_account.friendly_name }}<br />
</span>
% endfor
<span class="account-elsewhere">
{{ platform_icon_small(account.platform_data) }}
<span class="sr-only">{{ account.platform_data.display_name }}:</span>
<span class="highlight">
{{ account.friendly_name }}<br />
</span>
</span>
</div>
<div class="col-sm-4 other">
<b>{{ other.username }}</b><br />
% for other_account in other_accounts
% if other_account.platform != account.platform
<span class="account-elsewhere">
{{ platform_icon_small(other_account.platform_data) }}
<span class="sr-only">{{ other_account.platform_data.display_name }}:</span>
{{ other_account.friendly_name }}<br />
</span>
% endif
% endfor
</div>
</div>
<hr>
<form action="/on/take-over.html" method="POST">
<input type="hidden" name="account_id" value="{{ account_id }}" />
<input type="hidden" name="p_id" value="{{ p.id }}" />
<input type="hidden" name="then" value="{{ request.qs.get('then', '') }}" />
<input type="hidden" name="csrf_token" value="{{ csrf_token }}" />
<button name="should_transfer" value="yes" class="btn btn-success">{{ _("Transfer the account") }}</button>
<button name="should_transfer" value="no" class="btn btn-default" >{{ _("Cancel") }}</button>
</form>
</div>
% endblock