Commit cc0789a1 by Fred Smith

Merge pull request #6355 from edx/release

Release
parents 05ca4c46 de22ccd5
...@@ -536,6 +536,15 @@ def ensure_user_information( ...@@ -536,6 +536,15 @@ def ensure_user_information(
if is_register_2 and user_unset: if is_register_2 and user_unset:
return redirect(_create_redirect_url(AUTH_DISPATCH_URLS[AUTH_ENTRY_REGISTER_2], strategy)) return redirect(_create_redirect_url(AUTH_DISPATCH_URLS[AUTH_ENTRY_REGISTER_2], strategy))
# If the user has a linked account, but has not yet activated
# we should send them to the login page. The login page
# will tell them that they need to activate their account.
if is_register and user_inactive:
return redirect(_create_redirect_url(AUTH_DISPATCH_URLS[AUTH_ENTRY_LOGIN], strategy))
if is_register_2 and user_inactive:
return redirect(_create_redirect_url(AUTH_DISPATCH_URLS[AUTH_ENTRY_LOGIN_2], strategy))
def _create_redirect_url(url, strategy): def _create_redirect_url(url, strategy):
""" Given a URL and a Strategy, construct the appropriate redirect URL. """ Given a URL and a Strategy, construct the appropriate redirect URL.
......
...@@ -691,7 +691,19 @@ class IntegrationTest(testutil.TestCase, test.TestCase): ...@@ -691,7 +691,19 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
# social auth. # social auth.
self.assert_social_auth_does_not_exist_for_user(created_user, strategy) self.assert_social_auth_does_not_exist_for_user(created_user, strategy)
# We should be redirected back to the complete page, setting # Since the user's account is not yet active, we should be redirected to /login
self.assert_redirect_to_login_looks_correct(
actions.do_complete(
request.social_strategy, social_views._do_login, request.user, None, # pylint: disable-msg=protected-access
redirect_field_name=auth.REDIRECT_FIELD_NAME
)
)
# Activate the user's account
strategy.request.user.is_active = True
strategy.request.user.save()
# Try again. This time, we should be redirected back to the complete page, setting
# the "logged in" cookie for the marketing site. # the "logged in" cookie for the marketing site.
self.assert_logged_in_cookie_redirect(actions.do_complete( self.assert_logged_in_cookie_redirect(actions.do_complete(
request.social_strategy, social_views._do_login, request.user, None, # pylint: disable-msg=protected-access request.social_strategy, social_views._do_login, request.user, None, # pylint: disable-msg=protected-access
......
...@@ -157,6 +157,15 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements ...@@ -157,6 +157,15 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements
): ):
raise EventValidationError(WARNING_IGNORED_TYPE) raise EventValidationError(WARNING_IGNORED_TYPE)
# create and populate application field if it doesn't exist
app_context = segment_properties.get('context', {})
if 'application' not in app_context:
context['application'] = {
'name': app_context.get('app_name', ''),
'version': '' if not segment_context else segment_context.get('app', {}).get('version', '')
}
app_context.pop('app_name', None)
if segment_context: if segment_context:
# copy the entire segment's context dict as a sub-field of our custom context dict # copy the entire segment's context dict as a sub-field of our custom context dict
context['client'] = dict(segment_context) context['client'] = dict(segment_context)
...@@ -168,7 +177,7 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements ...@@ -168,7 +177,7 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements
del context['client'][field] del context['client'][field]
# Overlay any context provided in the properties # Overlay any context provided in the properties
context.update(segment_properties.get('context', {})) context.update(app_context)
user_id = full_segment_event.get('userId') user_id = full_segment_event.get('userId')
if not user_id: if not user_id:
......
...@@ -122,6 +122,7 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase): ...@@ -122,6 +122,7 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase):
'data': kwargs.get('data', {}), 'data': kwargs.get('data', {}),
'context': { 'context': {
'course_id': kwargs.get('course_id') or '', 'course_id': kwargs.get('course_id') or '',
'app_name': 'edx.mobile.android',
} }
}, },
"channel": 'server', "channel": 'server',
...@@ -130,6 +131,9 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase): ...@@ -130,6 +131,9 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase):
"name": kwargs.get('library_name', 'test-app'), "name": kwargs.get('library_name', 'test-app'),
"version": "unknown" "version": "unknown"
}, },
"app": {
"version": "1.0.1",
},
'userAgent': str(sentinel.user_agent), 'userAgent': str(sentinel.user_agent),
}, },
"receivedAt": "2014-08-27T16:33:39.100Z", "receivedAt": "2014-08-27T16:33:39.100Z",
...@@ -197,6 +201,10 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase): ...@@ -197,6 +201,10 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase):
'time': datetime.strptime("2014-08-27T16:33:39.215Z", "%Y-%m-%dT%H:%M:%S.%fZ"), 'time': datetime.strptime("2014-08-27T16:33:39.215Z", "%Y-%m-%dT%H:%M:%S.%fZ"),
'host': 'testserver', 'host': 'testserver',
'context': { 'context': {
'application': {
'name': 'edx.mobile.android',
'version': '1.0.1',
},
'user_id': USER_ID, 'user_id': USER_ID,
'course_id': course_id, 'course_id': course_id,
'org_id': 'foo', 'org_id': 'foo',
...@@ -205,7 +213,10 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase): ...@@ -205,7 +213,10 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase):
'library': { 'library': {
'name': 'test-app', 'name': 'test-app',
'version': 'unknown' 'version': 'unknown'
} },
'app': {
'version': '1.0.1',
},
}, },
'received_at': datetime.strptime("2014-08-27T16:33:39.100Z", "%Y-%m-%dT%H:%M:%S.%fZ"), 'received_at': datetime.strptime("2014-08-27T16:33:39.100Z", "%Y-%m-%dT%H:%M:%S.%fZ"),
}, },
...@@ -361,6 +372,9 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase): ...@@ -361,6 +372,9 @@ class SegmentIOTrackingTestCase(EventTrackingTestCase):
'name': 'test-app', 'name': 'test-app',
'version': 'unknown' 'version': 'unknown'
}, },
'app': {
'version': '1.0.1',
},
}, },
'application': { 'application': {
'name': 'edx.mobileapp.android', 'name': 'edx.mobileapp.android',
......
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