mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
Invited user email is shown on regiser from intive page but is not
editable.
This commit is contained in:
@@ -104,7 +104,7 @@ class RegisterUserFromInviteForm(Form):
|
||||
mobile_number = mobile_number()
|
||||
password = password()
|
||||
service = HiddenField('service')
|
||||
email_address = HiddenField('email_address')
|
||||
email_address = email_address()
|
||||
|
||||
|
||||
class InviteUserForm(Form):
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
help_link=None,
|
||||
help_link_text=None,
|
||||
width='2-3',
|
||||
suffix=None
|
||||
suffix=None,
|
||||
disabled=False
|
||||
) %}
|
||||
<div class="form-group{% if field.errors %} error{% endif %}" {% if autofocus %}data-module="autofocus"{% endif %}>
|
||||
<label class="form-label" for="{{ field.name }}">
|
||||
@@ -22,10 +23,20 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
</label>
|
||||
{{ field(**{
|
||||
'class': 'form-control form-control-{} textbox-highlight-textbox'.format(width) if highlight_tags else 'form-control form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else ''),
|
||||
'data-module': 'highlight-tags' if highlight_tags else ''
|
||||
}) }}
|
||||
{% if disabled %}
|
||||
{{ field(**{
|
||||
'class': 'form-control form-control-{} textbox-highlight-textbox'.format(width) if highlight_tags else 'form-control form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else ''),
|
||||
'data-module': 'highlight-tags' if highlight_tags else '',
|
||||
'disabled': 'disabled'
|
||||
}) }}
|
||||
{% else %}
|
||||
{{ field(**{
|
||||
'class': 'form-control form-control-{} textbox-highlight-textbox'.format(width) if highlight_tags else 'form-control form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else ''),
|
||||
'data-module': 'highlight-tags' if highlight_tags else ''
|
||||
}) }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if suffix %}
|
||||
<span>{{ suffix }}</span>
|
||||
{% endif %}
|
||||
|
||||
@@ -12,12 +12,12 @@ Create an account – GOV.UK Notify
|
||||
<div class="column-two-thirds">
|
||||
<h1 class="heading-large">Create an account</h1>
|
||||
<form method="post" autocomplete="nope">
|
||||
{{ textbox(form.email_address, width='3-4', disabled=True ) }}
|
||||
{{ textbox(form.name, width='3-4') }}
|
||||
{{ textbox(form.mobile_number, width='3-4') }}
|
||||
{{ textbox(form.password, hint="Your password must have at least 10 characters", width='3-4') }}
|
||||
{{ page_footer("Continue") }}
|
||||
{{form.service}}
|
||||
{{form.email_address}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -81,6 +81,39 @@ def test_new_user_accept_invite_calls_api_and_redirects_to_registration(app_,
|
||||
assert response.location == expected_redirect_location
|
||||
|
||||
|
||||
def test_new_user_accept_invite_calls_api_and_views_registration_page(app_,
|
||||
service_one,
|
||||
mock_check_invite_token,
|
||||
mock_dont_get_user_by_email,
|
||||
mock_add_user_to_service,
|
||||
mock_accept_invite):
|
||||
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
|
||||
response = client.get(url_for('main.accept_invite', token='thisisnotarealtoken'), follow_redirects=True)
|
||||
|
||||
mock_check_invite_token.assert_called_with('thisisnotarealtoken')
|
||||
mock_dont_get_user_by_email.assert_called_with('invited_user@test.gov.uk')
|
||||
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.h1.string.strip() == 'Create an account'
|
||||
|
||||
form = page.find('form')
|
||||
email = form.find('input', id='email_address')
|
||||
name = form.find('input', id='name')
|
||||
password = form.find('input', id='password')
|
||||
service = form.find('input', type='hidden', id='service')
|
||||
|
||||
assert email
|
||||
assert email.attrs['disabled']
|
||||
assert name
|
||||
assert password
|
||||
assert service
|
||||
assert service.attrs['value'] == service_one['id']
|
||||
|
||||
|
||||
def test_cancelled_invited_user_accepts_invited_redirect_to_cancelled_invitation(app_,
|
||||
service_one,
|
||||
mocker,
|
||||
|
||||
Reference in New Issue
Block a user