Skip to content

Commit

Permalink
CyVerse CAS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed May 8, 2020
1 parent 5a6a577 commit f441870
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
1 change: 0 additions & 1 deletion dev/dockerfiles/plantit/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ psycopg2-binary

#django rest framework requirements
djangorestframework
django-cors-headers

markdown # Markdown support for the browsable API.
django-filter # Filtering support
Expand Down
2 changes: 1 addition & 1 deletion plantit/apis/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ def login_view(request):

def logout_view(request):
logout(request)
return redirect('https://auth.iplantcollaborative.org/cas4/logout')
return redirect('https://auth.iplantcollaborative.org/cas4/logout', permanent=True)
41 changes: 34 additions & 7 deletions plantit/front_end/src/components/AppNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@
</b-container>
</template>
</b-sidebar>
<b-navbar
toggleable="lg"
class="logo m-0 p-0 pl-2 pr-2"
>
<b-navbar toggleable="lg" class="logo m-0 p-0 pl-2 pr-2">
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
<b-collapse class="m-0 p-0" is-nav>
<b-navbar-nav class="m-0 p-0 pl-3 mr-3">
Expand Down Expand Up @@ -260,7 +257,8 @@
v-for="crumb in crumbs"
:key="crumb.text"
class="background-transparent title mr-1"
:to="crumb.href">
:to="crumb.href"
>
{{ crumb.text }}
</b-breadcrumb-item>
<!--<b-navbar-nav
Expand Down Expand Up @@ -454,6 +452,24 @@
@saveUserInfo="saveUserInfo"
>
</EditUserInfoModal>
<b-alert
:show="reload_alert_dismiss_countdown"
dismissible
variant="success"
@dismissed="reload_alert_dismiss_countdown = 0"
@dismiss-count-down="countDownChanged"
>
<p>
User information updated. Thanks,
{{ this.info ? this.info.profile ? this.info.profile.first_name : '' : '' }}!
</p>
<b-progress
variant="dark"
:max="reload_alert_dismiss_seconds"
:value="reload_alert_dismiss_countdown"
height="2px"
></b-progress>
</b-alert>
</div>
</template>

Expand Down Expand Up @@ -494,7 +510,10 @@ export default {
version: 'alpha',
info: {},
crumbs: [],
not_found: false
not_found: false,
reload_alert_dismiss_seconds: 5,
reload_alert_dismiss_countdown: 0,
show_reload_alert: false
};
},
mounted: function() {
Expand All @@ -508,15 +527,23 @@ export default {
}
},
methods: {
reload() {
reload(toast) {
UserApi.getCurrentUser().then(info => {
this.info = info;
this.loading = false;
if (this.profileIncomplete) {
this.$bvModal.show('editUserInfoModalNav');
} else if (toast) {
this.showAlert();
}
});
},
countDownChanged(dismissCountDown) {
this.reload_alert_dismiss_countdown = dismissCountDown;
},
showAlert() {
this.reload_alert_dismiss_countdown = this.reload_alert_dismiss_seconds;
},
saveUserInfo(
userName,
firstName,
Expand Down
2 changes: 1 addition & 1 deletion plantit/front_end/src/views/Home.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<b-container fluid>
<b-row no-gutters="true">
<b-row no-gutters>
<b-col>
<HomeAbout></HomeAbout>
<HomeResearchers></HomeResearchers>
Expand Down
2 changes: 1 addition & 1 deletion plantit/front_end/src/views/Logout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Logging out of PlantIT...
</h5>
<p class="text-center">
Redirecting to <b-link href="https://auth.iplantcollaborative.org/cas4/logout">https://auth.iplantcollaborative.org/cas4/logout</b-link>...
If you are not automatically redirected to <b-link href="https://auth.iplantcollaborative.org/cas4/logout">https://auth.iplantcollaborative.org/cas4/logout</b-link>, please click the link.
</p>
</b-col>
</b-row>
Expand Down
7 changes: 0 additions & 7 deletions plantit/plantit/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@
'plantit.apps.PlantITConfig',
'front_end.apps.FrontEndConfig',
'django_cas_ng',
'corsheaders',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand All @@ -71,11 +69,6 @@
'django_cas_ng.backends.CASBackend',
)

CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = [
'http://localhost:80',
]

CAS_SERVER_URL = "https://auth.iplantcollaborative.org/cas4/"
# CAS_SERVER_URL = "https://auth.cyverse.org/cas5/login"
CAS_APPLY_ATTRIBUTES_TO_USER=True
Expand Down

0 comments on commit f441870

Please sign in to comment.