Merge branch 'master' into 'master'
Added ChangeDisplayNameForm to enable editing of the user display name

Fixes https://gitlab.com/mailman/postorius/issues/118

See merge request !128
commit 09bb33beaf8c6d5bcae3092dc9292a9ded32b325
2 parents d6f532b + ef5d70e
@Aurélien Bompard Aurélien Bompard authored on 4 May 2016
Showing 10 changed files
View
13
src/postorius/forms.py
pass
return email
 
 
class ChangeDisplayNameForm(forms.Form):
"""
Change display name.
"""
 
display_name = forms.CharField(
label=_('Display name'),
error_messages={
'required': _('Please enter a display name')},
required=True
)
 
 
class ChangeSubscriptionForm(forms.Form):
email = forms.ChoiceField()
 
def __init__(self, user_emails, *args, **kwargs):
View
4
src/postorius/templates/postorius/user/profile.html
</tr>
</tbody>
</table>
<hr />
<form class="form-horizontal" action="" method="post">
{% render_form_horizontal name_form 2 5 'Change display name' %}
<input type="hidden" name="formname" value="displayname" />
</form>
<p>
{% blocktrans %}
You can add other addresses to your profile,
to use different addresses for your subscriptions.
View
130
src/postorius/tests/fixtures/vcr_cassettes/TestProfile.test_change_display_name.yaml 0 → 100644
interactions:
- request:
body: email=les%40example.org
headers:
accept-encoding: ['gzip, deflate']
!!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded]
method: !!python/unicode POST
uri: http://localhost:9001/3.0/users
response:
body: {string: !!python/unicode ''}
headers:
content-length: ['0']
location: ['http://localhost:9001/3.0/users/30']
status: {code: 201, message: Created}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode GET
uri: http://localhost:9001/3.0/users/les@example.org
response:
body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag":
"\"c00fc606394cf49ec80428acaa232d09bfe0217e\"", "is_server_owner": false,
"password": "$6$rounds=609804$czHjKJQcPm5zGXNd$WvmPL9LDx0LVxsDZGT.jBnkaua0RVxfG1nYqe.0I.Zx8w8O1revKE6V2Y3ysJtWGKMXFbc18DjfIWr/1VH.IL1",
"self_link": "http://localhost:9001/3.0/users/30", "user_id": 30}'}
headers:
content-length: ['326']
content-type: [application/json; charset=utf-8]
status: {code: 200, message: OK}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode GET
uri: http://localhost:9001/3.0/users/30/addresses
response:
body: {string: !!python/unicode '{"entries": [{"email": "les@example.org", "http_etag":
"\"b93a5f58b47e659a7de9b8e690adbbd7a9a37365\"", "original_email": "les@example.org",
"registered_on": "2005-08-01T07:49:23", "self_link": "http://localhost:9001/3.0/addresses/les@example.org",
"user": "http://localhost:9001/3.0/users/30"}], "http_etag": "\"7ad219cc3e8d4c55ecfde78853d61d3e4d2057c8\"",
"start": 0, "total_size": 1}'}
headers:
content-length: ['385']
content-type: [application/json; charset=utf-8]
status: {code: 200, message: OK}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode GET
uri: http://localhost:9001/3.0/users/les@example.org
response:
body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "http_etag":
"\"c00fc606394cf49ec80428acaa232d09bfe0217e\"", "is_server_owner": false,
"password": "$6$rounds=609804$czHjKJQcPm5zGXNd$WvmPL9LDx0LVxsDZGT.jBnkaua0RVxfG1nYqe.0I.Zx8w8O1revKE6V2Y3ysJtWGKMXFbc18DjfIWr/1VH.IL1",
"self_link": "http://localhost:9001/3.0/users/30", "user_id": 30}'}
headers:
content-length: ['326']
content-type: [application/json; charset=utf-8]
status: {code: 200, message: OK}
- request:
body: display_name=testname
headers:
accept-encoding: ['gzip, deflate']
!!python/unicode content-type: [!!python/unicode application/x-www-form-urlencoded]
method: !!python/unicode PATCH
uri: http://localhost:9001/3.0/users/30
response:
body: {string: !!python/unicode ''}
headers:
content-length: ['0']
status: {code: 204, message: No Content}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode GET
uri: http://localhost:9001/3.0/users/30
response:
body: {string: !!python/unicode '{"created_on": "2005-08-01T07:49:23", "display_name":
"testname", "http_etag": "\"c779bcf5ba77ed5c9a37967ccd2c08171ece4f12\"", "is_server_owner":
false, "password": "$6$rounds=609804$czHjKJQcPm5zGXNd$WvmPL9LDx0LVxsDZGT.jBnkaua0RVxfG1nYqe.0I.Zx8w8O1revKE6V2Y3ysJtWGKMXFbc18DjfIWr/1VH.IL1",
"self_link": "http://localhost:9001/3.0/users/30", "user_id": 30}'}
headers:
content-length: ['354']
content-type: [application/json; charset=utf-8]
status: {code: 200, message: OK}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode GET
uri: http://localhost:9001/3.0/domains
response:
body: {string: !!python/unicode '{"http_etag": "\"32223434a0f3af4cdc4673d1fbc5bac1f6d98fd3\"",
"start": 0, "total_size": 0}'}
headers:
content-length: ['90']
content-type: [application/json; charset=utf-8]
status: {code: 200, message: OK}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode GET
uri: http://localhost:9001/3.0/users
response:
body: {string: !!python/unicode '{"entries": [{"created_on": "2005-08-01T07:49:23",
"display_name": "testname", "http_etag": "\"c779bcf5ba77ed5c9a37967ccd2c08171ece4f12\"",
"is_server_owner": false, "password": "$6$rounds=609804$czHjKJQcPm5zGXNd$WvmPL9LDx0LVxsDZGT.jBnkaua0RVxfG1nYqe.0I.Zx8w8O1revKE6V2Y3ysJtWGKMXFbc18DjfIWr/1VH.IL1",
"self_link": "http://localhost:9001/3.0/users/30", "user_id": 30}], "http_etag":
"\"e634e988fcb8f7e74dc2cf53588b6b882847e38b\"", "start": 0, "total_size":
1}'}
headers:
content-length: ['459']
content-type: [application/json; charset=utf-8]
status: {code: 200, message: OK}
- request:
body: null
headers:
accept-encoding: ['gzip, deflate']
method: !!python/unicode DELETE
uri: http://localhost:9001/3.0/users/30
response:
body: {string: !!python/unicode ''}
headers:
content-length: ['0']
status: {code: 204, message: No Content}
version: 1
View
src/postorius/tests/fixtures/vcr_cassettes/TestProfile.test_post_form_with_smtp_exception.yaml
View
src/postorius/tests/fixtures/vcr_cassettes/TestProfile.test_post_invalid_form_shows_error_msg.yaml
View
src/postorius/tests/fixtures/vcr_cassettes/TestProfile.test_post_valid_form_redirects_on_success.yaml
View
src/postorius/tests/fixtures/vcr_cassettes/TestProfile.test_post_valid_form_shows_success_message.yaml
View
src/postorius/tests/fixtures/vcr_cassettes/TestProfile.test_view_contains_form.yaml
View
src/postorius/tests/mailman_api_tests/test_profile.py
View
src/postorius/views/user.py