Allows forced profile completion to be disabled

This commit is contained in:
Kumar McMillan 2011-12-13 15:50:30 -06:00
Родитель f57ba669ad
Коммит d7ccb1531f
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -594,6 +594,20 @@ class TestLogin(UserViewBase):
data = json.loads(res.content)
eq_(data['profile_needs_completion'], True)
@patch.object(waffle, 'switch_is_active', lambda x: True)
@patch.object(settings, 'FORCE_PROFILE_COMPLETION', False)
@patch('httplib2.Http.request')
def test_disable_profile_completion(self, http_request):
email = 'newuser@example.com'
http_request.return_value = (200, json.dumps({'status': 'okay',
'email': email}))
res = self.client.post(reverse('users.browserid_login'),
data=dict(assertion='fake-assertion',
audience='fakeamo.org'))
eq_(res.status_code, 200)
data = json.loads(res.content)
eq_(data['profile_needs_completion'], False)
@patch.object(settings, 'REGISTER_USER_LIMIT', 1)
@patch.object(waffle, 'switch_is_active', lambda x: True)
@patch('httplib2.Http.request')

Просмотреть файл

@ -356,7 +356,9 @@ def browserid_login(request):
if profile.needs_tougher_password:
return http.HttpResponse("", status=400)
auth.login(request, profile.user)
return dict(profile_needs_completion=profile.needs_completion())
comp = (profile.needs_completion()
if settings.FORCE_PROFILE_COMPLETION else False)
return dict(profile_needs_completion=comp)
return http.HttpResponse(msg, status=401)

Просмотреть файл

@ -912,6 +912,9 @@ LOGOUT_REDIRECT_URL = "/"
# In the case of duplicates, the process is recursive up to this number
# of times.
MAX_GEN_USERNAME_TRIES = 50
# When True, prompt user to fill in his username / display name if he
# registered with browser ID
FORCE_PROFILE_COMPLETION = True
# Legacy Settings
# used by old-style CSRF token