Skip to content

Commit a9169ec

Browse files
Require 2FA to accept an org invite (#14485)
Co-authored-by: Mike Fiedler <[email protected]>
1 parent bde5681 commit a9169ec

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

warehouse/locale/messages.pot

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,14 +1345,14 @@ msgid ""
13451345
msgstr ""
13461346

13471347
#: warehouse/templates/accounts/invite-confirmation.html:32
1348-
#: warehouse/templates/accounts/organization-invite-confirmation.html:32
1348+
#: warehouse/templates/accounts/organization-invite-confirmation.html:40
13491349
#: warehouse/templates/manage/organizations.html:42
13501350
#: warehouse/templates/manage/projects.html:52
13511351
msgid "Accept"
13521352
msgstr ""
13531353

13541354
#: warehouse/templates/accounts/invite-confirmation.html:33
1355-
#: warehouse/templates/accounts/organization-invite-confirmation.html:33
1355+
#: warehouse/templates/accounts/organization-invite-confirmation.html:41
13561356
#: warehouse/templates/manage/organizations.html:46
13571357
#: warehouse/templates/manage/organizations.html:54
13581358
#: warehouse/templates/manage/projects.html:53
@@ -1402,13 +1402,20 @@ msgstr ""
14021402
msgid "Confirm Organization Invite"
14031403
msgstr ""
14041404

1405-
#: warehouse/templates/accounts/organization-invite-confirmation.html:26
1405+
#: warehouse/templates/accounts/organization-invite-confirmation.html:34
14061406
#, python-format
14071407
msgid ""
14081408
"Would you like to accept this invitation to join '%(organization_name)s' "
14091409
"as an organization %(role_name)s?"
14101410
msgstr ""
14111411

1412+
#: warehouse/templates/accounts/organization-invite-confirmation.html:45
1413+
#, python-format
1414+
msgid ""
1415+
"You must first enable <a href=\"%(href)s\">two-factor authentication</a> "
1416+
"on your account before accepting an invitation to join an organization."
1417+
msgstr ""
1418+
14121419
#: warehouse/templates/accounts/profile.html:16
14131420
#, python-format
14141421
msgid "Profile of %(username)s"

warehouse/templates/accounts/organization-invite-confirmation.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@
1717
{% trans %}Confirm Organization Invite{% endtrans %}
1818
{% endblock %}
1919

20-
{% block main %}
20+
{% block prompt %}
21+
{% if request.user.has_two_factor %}
22+
{{ super() }}
23+
{% else %}
24+
<!-- Content hidden -->
25+
{% endif %}
26+
{% endblock %}
2127

28+
{% block main %}
29+
{% if request.user.has_two_factor %}
2230
<form method="POST">
2331
<div class="form-group">
2432
<input name="csrf_token" type="hidden" value="{{ request.session.get_csrf_token() }}">
@@ -33,5 +41,10 @@
3341
<input name="decline" type="submit" value="{% trans %}Decline{% endtrans %}" class="button">
3442
</div>
3543
</form>
44+
{% else %}{# user has not enabled 2FA #}
45+
{% trans href=request.route_path('manage.account.two-factor') %}
46+
You must first enable <a href="{{ href }}">two-factor authentication</a> on your account before accepting an invitation to join an organization.
47+
{% endtrans %}
48+
{% endif %}
3649

3750
{% endblock %}

0 commit comments

Comments
 (0)