0001-authenticators-forbid-disabling-all-authenticators-6.patch
src/authentic2/apps/authenticators/templates/authentic2/authenticators/authenticator_detail.html | ||
---|---|---|
6 | 6 |
<span class="actions"> |
7 | 7 |
<a class="extra-actions-menu-opener"></a> |
8 | 8 | |
9 |
{% if not object.internal %} |
|
9 | 10 |
<a href="{% url 'a2-manager-authenticator-toggle' pk=object.pk %}">{{ object.enabled|yesno:_("Disable,Enable") }}</a> |
11 |
{% endif %} |
|
10 | 12 |
<a href="{% url 'a2-manager-authenticator-edit' pk=object.pk %}">{% trans "Edit" %}</a> |
11 | 13 |
<ul class="extra-actions-menu"> |
12 | 14 |
{% if not object.internal %} |
tests/test_manager_authenticators.py | ||
---|---|---|
73 | 73 |
"Show condition: 'backoffice' in login_hint or remotre_addr == '1.2.3.4'" |
74 | 74 |
in resp.text |
75 | 75 |
) |
76 |
resp = resp.click('Disable').follow() |
|
77 |
assert 'Authenticator has been disabled.' in resp.text |
|
78 | ||
79 |
resp = app.get('/manage/authenticators/') |
|
80 |
assert 'class="section disabled"' in resp.text |
|
81 | 76 | |
82 |
resp = resp.click('Configure') |
|
83 |
resp = resp.click('Enable').follow() |
|
84 |
assert 'Authenticator has been enabled.' in resp.text |
|
77 |
# password authenticator cannot be disabled |
|
78 |
assert 'Disable' not in resp.text |
|
85 | 79 | |
86 | 80 |
# cannot add another password authenticator |
87 | 81 |
resp = app.get('/manage/authenticators/add/') |
... | ... | |
148 | 142 |
assert 'This field is required' in resp.text |
149 | 143 | |
150 | 144 |
resp = app.get('/manage/authenticators/') |
145 |
resp = resp.click('Configure', index=1) |
|
146 |
resp = resp.click('Disable').follow() |
|
147 |
assert 'Authenticator has been disabled.' in resp.text |
|
148 | ||
149 |
resp = app.get('/manage/authenticators/') |
|
150 |
assert 'class="section disabled"' in resp.text |
|
151 | ||
151 | 152 |
resp = resp.click('Configure', index=1) |
152 | 153 |
resp = resp.click('Delete') |
153 | 154 |
resp = resp.form.submit().follow() |
154 |
- |