change(users.validate): users can't edit their own account types

This commit also decouples testing regarding this feature
into several test functions.

Signed-off-by: Kevin Morris <kevr@0cost.org>

bump

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-12-14 14:31:46 -08:00
parent c7751d5d63
commit f357615bfb
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 146 additions and 128 deletions

View file

@ -43,24 +43,25 @@
</p>
{% if request.user.has_credential(creds.ACCOUNT_CHANGE_TYPE) %}
<p>
<label for="id_type">
{% trans %}Account Type{% endtrans %}:
</label>
<select name="T" id="id_type">
{% for value, type in account_types %}
<option value="{{ value }}"
{% if request.user.AccountType.ID == value %}
selected="selected"
{% endif %}
>
{{ type | tr }}
</option>
{% endfor %}
</select>
</p>
{% if request.user != user %}
<p>
<label for="id_type">
{% trans %}Account Type{% endtrans %}:
</label>
<select name="T" id="id_type">
{% for value, type in account_types %}
<option value="{{ value }}"
{% if request.user.AccountType.ID == value %}
selected="selected"
{% endif %}
>
{{ type | tr }}
</option>
{% endfor %}
</select>
</p>
{% endif %}
<p>
<label for="id_suspended">
{% trans %}Account Suspended{% endtrans %}: