Skip to content

Commit

Permalink
Make the studio login over the lms optional using a feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemontoya committed Mar 11, 2019
1 parent 5d3c9b3 commit 80b977f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ def get_env_setting(setting):
HEARTBEAT_EXTENDED_CHECKS = ENV_TOKENS.get('HEARTBEAT_EXTENDED_CHECKS', HEARTBEAT_EXTENDED_CHECKS)
HEARTBEAT_CELERY_TIMEOUT = ENV_TOKENS.get('HEARTBEAT_CELERY_TIMEOUT', HEARTBEAT_CELERY_TIMEOUT)

# Login using the LMS as the identity provider
if FEATURES.get('DISABLE_STUDIO_SSO_OVER_LMS', False):
LOGIN_URL = EDX_ROOT_URL + '/signin'

# Specific setting for the File Upload Service to store media in a bucket.
FILE_UPLOAD_STORAGE_BUCKET_NAME = ENV_TOKENS.get('FILE_UPLOAD_STORAGE_BUCKET_NAME', FILE_UPLOAD_STORAGE_BUCKET_NAME)
FILE_UPLOAD_STORAGE_PREFIX = ENV_TOKENS.get('FILE_UPLOAD_STORAGE_PREFIX', FILE_UPLOAD_STORAGE_PREFIX)
Expand Down
11 changes: 9 additions & 2 deletions cms/templates/widgets/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,15 @@ <h3 class="title"><span class="label"><a href="${get_online_help_info(online_hel

% else:
<%
login_url = settings.LMS_ROOT_URL + '/login'
register_url = settings.LMS_ROOT_URL + '/register'

if settings.FEATURES.get('DISABLE_STUDIO_SSO_OVER_LMS', False):
login_url = settings.LOGIN_URL
else:
login_url = '{lms_root_url}/login?next={next_url}'.format(
lms_root_url=settings.LMS_ROOT_URL,
next_url=current_url,
)
%>
<nav class="nav-not-signedin nav-pitch" aria-label="${_('Account')}">
<h2 class="sr-only">${_("Account Navigation")}</h2>
Expand All @@ -245,7 +252,7 @@ <h2 class="sr-only">${_("Account Navigation")}</h2>
</li>
% endif
<li class="nav-item nav-not-signedin-signin">
<a class="action action-signin" href="${login_url}?next=${current_url}">${_("Sign In")}</a>
<a class="action action-signin" href="${login_url}">${_("Sign In")}</a>
</li>
</ol>
</nav>
Expand Down
10 changes: 8 additions & 2 deletions cms/templates/widgets/user_dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ <h3 class="title">
<span class="icon fa fa-caret-down ui-toggle-dd" aria-hidden="true"></span>
</h3>
<%
logout_url = settings.LMS_ROOT_URL + '/logout'
if settings.FEATURES.get('DISABLE_STUDIO_SSO_OVER_LMS', False):
logout_url = reverse('logout')
else:
logout_url = '{lms_root_url}/logout?next={next_url}'.format(
lms_root_url=settings.LMS_ROOT_URL,
next_url=current_site_url,
)
%>
<div class="wrapper wrapper-nav-sub">
<div class="nav-sub">
Expand All @@ -54,7 +60,7 @@ <h3 class="title">
</li>
% endif
<li class="nav-item nav-account-signout">
<a class="action action-signout" href="${logout_url}?next=${current_site_url}">${_("Sign Out")}</a>
<a class="action action-signout" href="${logout_url}">${_("Sign Out")}</a>
</li>
</ul>
</div>
Expand Down

0 comments on commit 80b977f

Please sign in to comment.