Fix test, add env-variables

This commit is contained in:
Christian Cueni 2021-05-17 11:35:39 +02:00
parent 85f730644f
commit 08e259ebf6
6 changed files with 17 additions and 42 deletions

View File

@ -48,7 +48,7 @@ describe('The Login Page', () => {
cy.get('[data-cy=logout]').click(); 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'); cy.visit('/beta-login');
}); });

View File

@ -154,6 +154,7 @@ function joiningClass(to) {
} }
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
console.log('to', from, to)
if (to.path === '/logout') { if (to.path === '/logout') {
publicApolloClient.resetStore(); publicApolloClient.resetStore();
next({name: 'hello'}); next({name: 'hello'});
@ -162,7 +163,7 @@ router.beforeEach(async (to, from, next) => {
if (unauthorizedAccess(to)) { if (unauthorizedAccess(to)) {
const postLoginRedirectionUrl = to.path; const postLoginRedirectionUrl = to.path;
const redirectUrl = `/api/oauth/login/`; const redirectUrl = `/hello/`;
if (window.localStorage) { if (window.localStorage) {
localStorage.setItem(postLoginRederictUrlKey, postLoginRedirectionUrl); localStorage.setItem(postLoginRederictUrlKey, postLoginRedirectionUrl);

View File

@ -3,7 +3,8 @@
<h1 <h1
class="hello__title public-page__title" class="hello__title public-page__title"
data-cy="hello-title">Wollen Sie {{ pageTitle }} jetzt im Unterricht verwenden?</h1> data-cy="hello-title">Wollen Sie {{ pageTitle }} jetzt im Unterricht verwenden?</h1>
<a href="/api/oauth/login/">Login</a> <a href="/api/oauth/login/"
data-cy="oauth-login">Login</a>
</div> </div>
</template> </template>
@ -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();
}
}
}; };
</script> </script>

View File

@ -8,8 +8,6 @@ export EMAIL_HOST_PASSWORD=
export EMAIL_HOST_USER= export EMAIL_HOST_USER=
export EMAIL_PORT= export EMAIL_PORT=
export GOOGLE_ANALYTICS_ID= export GOOGLE_ANALYTICS_ID=
export HEP_ADMIN_PASSWORD=
export HEP_ADMIN_USER=
export HEP_URL= export HEP_URL=
export HEP_URL=https://stage.hep-verlag.ch export HEP_URL=https://stage.hep-verlag.ch
export MATOMO_HOST= export MATOMO_HOST=
@ -33,3 +31,9 @@ export PG_BACKUP_KEY=
export BACKUP_AWS_ACCESS_KEY_ID= export BACKUP_AWS_ACCESS_KEY_ID=
export BACKUP_AWS_SECRET_ACCESS_KEY= export BACKUP_AWS_SECRET_ACCESS_KEY=
export BACKUP_S3_BUCKET_NAME= 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=

View File

@ -397,8 +397,6 @@ EMAIL_USE_SSL = False
ALLOW_BETA_LOGIN = True ALLOW_BETA_LOGIN = True
# HEP # 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_URL = os.environ.get("HEP_URL")
# HEP Oauth # HEP Oauth

View File

@ -9,4 +9,10 @@ export DATABASE_URL=postgres://$DATABASE_USER:$PGPASSWORD@$DATABASE_HOST:$DATABA
export DEBUG=True export DEBUG=True
export USE_AWS=False export USE_AWS=False
export SERVE_VIA_WEBPACK=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 pipenv install --dev --system