diff --git a/client/cypress/integration/e2e/users/beta-login.spec.js b/client/cypress/integration/e2e/users/beta-login.spec.js index 24ed4d06..01861431 100644 --- a/client/cypress/integration/e2e/users/beta-login.spec.js +++ b/client/cypress/integration/e2e/users/beta-login.spec.js @@ -48,7 +48,7 @@ describe('The Login Page', () => { cy.get('[data-cy=logout]').click(); - cy.get('[data-cy=email-input]').should('exist').within(() => { + cy.get('[data-cy=oauth-login]').should('exist').within(() => { cy.visit('/beta-login'); }); diff --git a/client/src/main.js b/client/src/main.js index 457e25dc..afc7f160 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -154,6 +154,7 @@ function joiningClass(to) { } router.beforeEach(async (to, from, next) => { + console.log('to', from, to) if (to.path === '/logout') { publicApolloClient.resetStore(); next({name: 'hello'}); @@ -162,7 +163,7 @@ router.beforeEach(async (to, from, next) => { if (unauthorizedAccess(to)) { const postLoginRedirectionUrl = to.path; - const redirectUrl = `/api/oauth/login/`; + const redirectUrl = `/hello/`; if (window.localStorage) { localStorage.setItem(postLoginRederictUrlKey, postLoginRedirectionUrl); diff --git a/client/src/pages/hello.vue b/client/src/pages/hello.vue index eb3e658b..0c6d6266 100644 --- a/client/src/pages/hello.vue +++ b/client/src/pages/hello.vue @@ -3,7 +3,8 @@

Wollen Sie {{ pageTitle }} jetzt im Unterricht verwenden?

- Login + Login @@ -27,41 +28,6 @@ }; }, - methods: { - validateBeforeSubmit() { - this.$validator.validate().then(result => { - this.submitted = true; - if (result) { - this.loading = true; - // emailExists(this.email).then((response) => { - // let redirectRouteName = 'login'; - // - // if (response.data) { - // redirectRouteName = 'registration'; - // } - // this.$apollo.mutate({ - // mutation: HELLO_EMAIL_MUTATION, - // variables: { - // helloEmail: this.email - // } - // }).then(() => { - // this.$router.push({name: redirectRouteName, query: this.$route.query}); - // this.loading = false; - // }); - // }) - // .catch(() => { - // this.loading = false; - // this.registrationError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es nochmals.'; - // }); - } - }); - }, - resetForm() { - this.email = ''; - this.submitted = false; - this.$validator.reset(); - } - } }; diff --git a/server/.env.example b/server/.env.example index 80e8b928..20ae4f46 100644 --- a/server/.env.example +++ b/server/.env.example @@ -8,8 +8,6 @@ export EMAIL_HOST_PASSWORD= export EMAIL_HOST_USER= export EMAIL_PORT= export GOOGLE_ANALYTICS_ID= -export HEP_ADMIN_PASSWORD= -export HEP_ADMIN_USER= export HEP_URL= export HEP_URL=https://stage.hep-verlag.ch export MATOMO_HOST= @@ -33,3 +31,9 @@ export PG_BACKUP_KEY= export BACKUP_AWS_ACCESS_KEY_ID= export BACKUP_AWS_SECRET_ACCESS_KEY= export BACKUP_S3_BUCKET_NAME= +export OAUTH_CLIENT_ID= +export OAUTH_CLIENT_SECRET= +export OAUTH_ACCESS_TOKEN_URL= +export OAUTH_AUTHORIZE_URL= +export OAUTH_API_BASE_URL= +export OAUTH_LOCAL_REDIRECT_URI= diff --git a/server/core/settings.py b/server/core/settings.py index 4d512d15..9d6fd355 100644 --- a/server/core/settings.py +++ b/server/core/settings.py @@ -397,8 +397,6 @@ EMAIL_USE_SSL = False ALLOW_BETA_LOGIN = True # HEP -HEP_ADMIN_USER = os.environ.get("HEP_ADMIN_USER") -HEP_ADMIN_PASSWORD = os.environ.get("HEP_ADMIN_PASSWORD") HEP_URL = os.environ.get("HEP_URL") # HEP Oauth diff --git a/setup-for-tests.sh b/setup-for-tests.sh index 8a33df12..0d9f092c 100755 --- a/setup-for-tests.sh +++ b/setup-for-tests.sh @@ -9,4 +9,10 @@ export DATABASE_URL=postgres://$DATABASE_USER:$PGPASSWORD@$DATABASE_HOST:$DATABA export DEBUG=True export USE_AWS=False export SERVE_VIA_WEBPACK=False +export OAUTH_CLIENT_ID=1111111-222222-333-3444444 +export OAUTH_CLIENT_SECRET=Abcd1234! +export OAUTH_ACCESS_TOKEN_URL=https://hepverlag-cms.grape.novu.ch/oauth/token +export OAUTH_AUTHORIZE_URL=https://hepverlag-cms.grape.novu.ch/oauth/authorize +export OAUTH_API_BASE_URL=https://hepverlag-cms.grape.novu.ch/ +export OAUTH_LOCAL_REDIRECT_URI=http://localhost:8000/api/oauth/callback/ pipenv install --dev --system