Commit 32c6b250 by Jason Bau Committed by Joe Blaylock

Turn off Agreement to Terms of Service for Stanford shib

As stipulated by Stanford's office of general counsel
parent 3f810add
...@@ -239,8 +239,13 @@ def signup(request, eamap=None): ...@@ -239,8 +239,13 @@ def signup(request, eamap=None):
'extauth_email': eamap.external_email, 'extauth_email': eamap.external_email,
'extauth_username': username, 'extauth_username': username,
'extauth_name': eamap.external_name, 'extauth_name': eamap.external_name,
'ask_for_tos': True,
} }
# Can't have terms of service for Stanford users, according to Stanford's Office of General Counsel
if settings.MITX_FEATURES['AUTH_USE_SHIB'] and ('stanford' in eamap.external_domain):
context['ask_for_tos'] = False
# detect if full name is blank and ask for it from user # detect if full name is blank and ask for it from user
context['ask_for_fullname'] = eamap.external_name.strip() == '' context['ask_for_fullname'] = eamap.external_name.strip() == ''
......
...@@ -613,17 +613,27 @@ def create_account(request, post_override=None): ...@@ -613,17 +613,27 @@ def create_account(request, post_override=None):
js['field'] = 'honor_code' js['field'] = 'honor_code'
return HttpResponse(json.dumps(js)) return HttpResponse(json.dumps(js))
if post_vars.get('terms_of_service', 'false') != u'true': # Can't have terms of service for Stanford users, according to Stanford's Office of General Counsel
js['value'] = "You must accept the terms of service.".format(field=a) if settings.MITX_FEATURES.get("AUTH_USE_SHIB") and DoExternalAuth and ("stanford" in eamap.external_domain):
js['field'] = 'terms_of_service' pass
return HttpResponse(json.dumps(js)) else:
if post_vars.get('terms_of_service', 'false') != u'true':
js['value'] = "You must accept the terms of service.".format(field=a)
js['field'] = 'terms_of_service'
return HttpResponse(json.dumps(js))
# Confirm appropriate fields are there. # Confirm appropriate fields are there.
# TODO: Check e-mail format is correct. # TODO: Check e-mail format is correct.
# TODO: Confirm e-mail is not from a generic domain (mailinator, etc.)? Not sure if # TODO: Confirm e-mail is not from a generic domain (mailinator, etc.)? Not sure if
# this is a good idea # this is a good idea
# TODO: Check password is sane # TODO: Check password is sane
for a in ['username', 'email', 'name', 'password', 'terms_of_service', 'honor_code']:
required_post_vars = ['username', 'email', 'name', 'password', 'terms_of_service', 'honor_code']
if settings.MITX_FEATURES.get("AUTH_USE_SHIB") and DoExternalAuth and ("stanford" in eamap.external_domain):
# Can't have terms of service for Stanford users, according to Stanford's Office of General Counsel
required_post_vars = ['username', 'email', 'name', 'password', 'honor_code']
for a in required_post_vars:
if len(post_vars[a]) < 2: if len(post_vars[a]) < 2:
error_str = {'username': 'Username must be minimum of two characters long.', error_str = {'username': 'Username must be minimum of two characters long.',
'email': 'A properly formatted e-mail is required.', 'email': 'A properly formatted e-mail is required.',
......
...@@ -231,11 +231,16 @@ ...@@ -231,11 +231,16 @@
<ol class="list-input"> <ol class="list-input">
<li class="field-group"> <li class="field-group">
% if has_extauth_info is UNDEFINED or ask_for_tos :
<div class="field required checkbox" id="field-tos"> <div class="field required checkbox" id="field-tos">
<input id="tos-yes" type="checkbox" name="terms_of_service" value="true" required aria-required="true" /> <input id="tos-yes" type="checkbox" name="terms_of_service" value="true" required aria-required="true" />
<label for="tos-yes">I agree to the <a href="${marketing_link('TOS')}" class="new-vp">Terms of Service</a></label> <label for="tos-yes">I agree to the <a href="${marketing_link('TOS')}" class="new-vp">Terms of Service</a></label>
</div> </div>
% endif
<div class="field required checkbox" id="field-honorcode"> <div class="field required checkbox" id="field-honorcode">
<input id="honorcode-yes" type="checkbox" name="honor_code" value="true" /> <input id="honorcode-yes" type="checkbox" name="honor_code" value="true" />
<% <%
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment