From 086a9a96548ab7a45f8674b12ab3682b9192bcf5 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Wed, 13 Sep 2023 16:09:11 +0200 Subject: [PATCH] start work on newsletter plugin --- .../others/newsletter/newsletterRoutes.js | 36 ++++++++++++++++++- src/server/config/settings.config.json | 4 +-- .../views/purchasing/PaymentSuccessView.vue | 3 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/server/backend/plugins/others/newsletter/newsletterRoutes.js b/src/server/backend/plugins/others/newsletter/newsletterRoutes.js index 80cb39b..77839ce 100644 --- a/src/server/backend/plugins/others/newsletter/newsletterRoutes.js +++ b/src/server/backend/plugins/others/newsletter/newsletterRoutes.js @@ -7,4 +7,38 @@ * */ -module.exports = ( app, settings ) => {}; \ No newline at end of file +const path = require( 'path' ); +const mm = require( '../../../mail/mailSender.js' ); +const sendMail = new mm(); + +module.exports = ( app, settings ) => { + app.get( '/admin/mail/compose', ( request, response ) => { + if ( request.session.loggedInAdmin ) { + response.sendFile( path.join( __dirname + '/html/compose.html' ) ); + } else { + response.status( 403 ).send( 'unauthenticated' ); + } + } ); + + app.post( '/admin/mail/send', ( request, response ) => { + if ( request.session.loggedInAdmin ) { + response.send( 'ok' ); + sendMail.send( request.body.message, request.body.subject, request.body.mode, request.body.replyTo, request.body.receiver, request.body.lang ); + } else { + response.status( 403 ).send( 'unauthenticated' ); + } + } ); + + app.get( '/mail/unsubscribe', ( request, response ) => { + response.sendFile( path.join( __dirname + '/html/unsubscribe.html' ) ); + } ); + + app.post( '/mail/unsubscribe/go', ( request, response ) => { + if ( request.body.mail == '' ) { + response.sendFile( path.join( __dirname + '/html/unsubscribeError.html' ) ); + } else { + sendMail.unsubscribe( request.body.mail ); + response.sendFile( path.join( __dirname + '/html/unsubscribeComplete.html' ) ); + } + } ); +}; \ No newline at end of file diff --git a/src/server/config/settings.config.json b/src/server/config/settings.config.json index 37c2fb3..3d6a25a 100644 --- a/src/server/config/settings.config.json +++ b/src/server/config/settings.config.json @@ -3,8 +3,8 @@ "setupDone":true, "twoFA":"enforce", "twoFAMode":"enhanced", - "db":"json", - "payments":"payrexx", + "db":"mysql", + "payments":"stripe", "name":"libreevent", "yourDomain":"http://localhost:8080", "mailSender":"libreevent ", diff --git a/src/webapp/main/src/views/purchasing/PaymentSuccessView.vue b/src/webapp/main/src/views/purchasing/PaymentSuccessView.vue index 0a97d8f..d087e23 100644 --- a/src/webapp/main/src/views/purchasing/PaymentSuccessView.vue +++ b/src/webapp/main/src/views/purchasing/PaymentSuccessView.vue @@ -13,9 +13,8 @@

Thank you for your purchase!

The system is currently processing your order and you will be able to download your tickets within a moment's notice.

You will receive an email with your tickets within the next few minutes

-

If the email does not arrive withing the next 10 minutes, please click here

-