mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Add validation for agreement accepted on behalf of
If the user has selected that they are accepting the agreement on behalf of someone else then we need to make the they provide that person’s details. If they’ve selected that they are accepting the agreement themselves then we have to ignore what they might have put in the ‘on behalf of boxes’ (for example if they filled them out but then changed their mind).
This commit is contained in:
@@ -33,20 +33,10 @@ def service_agreement(service_id):
|
||||
@login_required
|
||||
def service_accept_agreement(service_id):
|
||||
|
||||
org = current_service.organisation
|
||||
|
||||
if not org:
|
||||
if not current_service.organisation:
|
||||
abort(404)
|
||||
|
||||
form = AcceptAgreementForm(
|
||||
version=org.agreement_signed_version,
|
||||
who='someone-else' if (
|
||||
org.agreement_signed_on_behalf_of_name
|
||||
and org.agreement_signed_on_behalf_of_email_address
|
||||
) else 'me',
|
||||
on_behalf_of_name=org.agreement_signed_on_behalf_of_name,
|
||||
on_behalf_of_email=org.agreement_signed_on_behalf_of_email_address,
|
||||
)
|
||||
form = AcceptAgreementForm.from_organisation(current_service.organisation)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.organisation.update(
|
||||
|
||||
Reference in New Issue
Block a user