start work on newsletter plugin

This commit is contained in:
2023-09-13 16:09:11 +02:00
parent d7eed47d2c
commit 086a9a9654
3 changed files with 38 additions and 5 deletions

View File

@@ -7,4 +7,38 @@
*
*/
module.exports = ( app, settings ) => {};
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' ) );
}
} );
};

View File

@@ -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 <no-reply@libreevent.janishutz.com>",

View File

@@ -13,9 +13,8 @@
<h1 style="font-size: 250%;">Thank you for your purchase!</h1>
<p>The system is currently processing your order and you will be able to download your tickets within a moment's notice.</p>
<p>You will receive an email with your tickets within the next few minutes</p>
<p class="small">If the email does not arrive withing the next 10 minutes, please click <a href="/payments/resendTickets" target="_blank">here</a></p>
<a href="/tickets/tickets.pdf" class="submit" style="display: none;" id="manual-download">Download manually</a>
<button onclick="if ( confirm( 'Do you really want to leave this page? If you want to download the tickets directly, you will need to head to your account page and download the ticket from there or stay on this page and wait for the order to finish processing.' ) ) {
<button onclick="if ( confirm( 'Do you really want to leave this page? You will not be able to download the tickets directly and instead you will have to download them from the email.' ) ) {
location.href = '/' }" class="submit">Back to the home page</button>
</div>
<notifications ref="notification" location="bottomright" size="bigger"></notifications>