mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
add mail notification if processing fails
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<img :src="host + '/otherAssets/logo.png'" alt="Logo" class="logo">
|
<img :src="host + '/otherAssets/logo.png'" alt="Logo" class="logo">
|
||||||
<h1>Welcome back!</h1>
|
<h1>Welcome back!</h1>
|
||||||
<p>It looks like someone is trying to sign in to your admin account at {{ pageName }}. If it was you, please click the button below to confirm the login. If not, please <a :href="host + '/admin/profile/settings'">change</a> your password immediately or have it changed by the root account!</p>
|
<p>It looks like someone is trying to sign in to your admin account at {{ pageName }}. If it was you, please click the button below to confirm the login. If not, please <a :href="host + '/admin/settings'">change</a> your password immediately or have it changed by the root account!</p>
|
||||||
<p class="ip">Logging in from IP {{ ip }}.</p>
|
<p class="ip">Logging in from IP {{ ip }}.</p>
|
||||||
<a :href="host + '/admin/2fa?token=' + token" class="verify">Verify</a>
|
<a :href="host + '/admin/2fa?token=' + token" class="verify">Verify</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ module.exports = ( app, settings ) => {
|
|||||||
}, 1000 );
|
}, 1000 );
|
||||||
db.getDataSimple( 'processingOrders', 'user_id', sessionReference[ response.data.data[ 0 ].id ][ 'tok' ] ).then( dat => {
|
db.getDataSimple( 'processingOrders', 'user_id', sessionReference[ response.data.data[ 0 ].id ][ 'tok' ] ).then( dat => {
|
||||||
db.getDataSimple( 'users', 'email', sessionReference[ response.data.data[ 0 ].id ][ 'email' ] ).then( user => {
|
db.getDataSimple( 'users', 'email', sessionReference[ response.data.data[ 0 ].id ][ 'email' ] ).then( user => {
|
||||||
if ( user[ 0 ] ) {
|
if ( user[ 0 ] && dat[ 0 ] ) {
|
||||||
const tickets = JSON.parse( dat[ 0 ].data );
|
const tickets = JSON.parse( dat[ 0 ].data );
|
||||||
db.writeDataSimple( 'orders', 'account_id', user[ 0 ].account_id, { 'account_id': user[ 0 ].account_id, 'tickets': dat[ 0 ].data, 'order_name': sessionReference[ response.data.data[ 0 ].id ][ 'tok' ] } ).then( () => {
|
db.writeDataSimple( 'orders', 'account_id', user[ 0 ].account_id, { 'account_id': user[ 0 ].account_id, 'tickets': dat[ 0 ].data, 'order_name': sessionReference[ response.data.data[ 0 ].id ][ 'tok' ] } ).then( () => {
|
||||||
console.log( sessionReference[ response.data.data[ 0 ].id ][ 'tok' ] );
|
console.log( sessionReference[ response.data.data[ 0 ].id ][ 'tok' ] );
|
||||||
@@ -193,8 +193,7 @@ module.exports = ( app, settings ) => {
|
|||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
console.log( sessionReference[ response.data.data[ 0 ].id ][ 'email' ] );
|
TicketGenerator.sendErrorMail( sessionReference[ response.data.data[ 0 ].id ][ 'tok' ], sessionReference[ response.data.data[ 0 ].id ][ 'email' ] );
|
||||||
console.error( 'user not found' );
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} ).catch( err => {
|
} ).catch( err => {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ module.exports = ( app, settings ) => {
|
|||||||
}, 1000 );
|
}, 1000 );
|
||||||
db.getDataSimple( 'processingOrders', 'user_id', sessionReference[ event.data.object.id ][ 'tok' ] ).then( dat => {
|
db.getDataSimple( 'processingOrders', 'user_id', sessionReference[ event.data.object.id ][ 'tok' ] ).then( dat => {
|
||||||
db.getDataSimple( 'users', 'email', sessionReference[ event.data.object.id ][ 'email' ] ).then( user => {
|
db.getDataSimple( 'users', 'email', sessionReference[ event.data.object.id ][ 'email' ] ).then( user => {
|
||||||
if ( user[ 0 ] ) {
|
if ( user[ 0 ] && dat[ 0 ] ) {
|
||||||
const tickets = JSON.parse( dat[ 0 ].data );
|
const tickets = JSON.parse( dat[ 0 ].data );
|
||||||
db.writeDataSimple( 'orders', 'account_id', user[ 0 ].account_id, { 'account_id': user[ 0 ].account_id, 'tickets': dat[ 0 ].data, 'order_name': sessionReference[ event.data.object.id ][ 'tok' ] } ).then( () => {
|
db.writeDataSimple( 'orders', 'account_id', user[ 0 ].account_id, { 'account_id': user[ 0 ].account_id, 'tickets': dat[ 0 ].data, 'order_name': sessionReference[ event.data.object.id ][ 'tok' ] } ).then( () => {
|
||||||
TicketGenerator.generateTickets( sessionReference[ event.data.object.id ] );
|
TicketGenerator.generateTickets( sessionReference[ event.data.object.id ] );
|
||||||
@@ -193,7 +193,7 @@ module.exports = ( app, settings ) => {
|
|||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
console.error( 'user not found' );
|
TicketGenerator.sendErrorMail( sessionReference[ event.data.object.id ][ 'tok' ], sessionReference[ event.data.object.id ][ 'email' ] );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} ).catch( err => {
|
} ).catch( err => {
|
||||||
|
|||||||
@@ -46,6 +46,37 @@ class TicketGenerator {
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendErrorMail( order, email ) {
|
||||||
|
db.getJSONData( 'rootAccount' ).then( res => {
|
||||||
|
( async() => {
|
||||||
|
const app = createSSRApp( {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
host: settings.yourDomain,
|
||||||
|
pageName: settings.name,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
template: '' + fs.readFileSync( path.join( __dirname + '/../../ui/en/payments/failedToProcessMail.html' ) )
|
||||||
|
} );
|
||||||
|
|
||||||
|
mailManager.sendMail( email, await renderToString( app ), 'Your order failed to process', settings.mailSender );
|
||||||
|
|
||||||
|
const adminNot = createSSRApp( {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
host: settings.yourDomain,
|
||||||
|
email: email,
|
||||||
|
order_id: order,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
template: '' + fs.readFileSync( path.join( __dirname + '/../../ui/en/payments/failedToProcessDetailsMail.html' ) )
|
||||||
|
} );
|
||||||
|
|
||||||
|
mailManager.sendMail( res.email, await renderToString( adminNot ), 'Your order failed to process', settings.mailSender );
|
||||||
|
} )();
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
generateTickets ( order ) {
|
generateTickets ( order ) {
|
||||||
this.ticketQueue[ this.jobId ] = { 'order': order };
|
this.ticketQueue[ this.jobId ] = { 'order': order };
|
||||||
this.runningTickets[ order.tok ] = 'processing';
|
this.runningTickets[ order.tok ] = 'processing';
|
||||||
|
|||||||
69
src/server/ui/en/payments/failedToProcessDetailsMail.html
Normal file
69
src/server/ui/en/payments/failedToProcessDetailsMail.html
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Two-Factor Authentication</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 80%;
|
||||||
|
height: 800px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ip {
|
||||||
|
color: rgb(94, 94, 94);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
width: 70vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify {
|
||||||
|
padding: 20px 30px;
|
||||||
|
background-color: rgb(0, 7, 87);
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
transition: 0.5s all;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify:hover {
|
||||||
|
background-color: rgb(0, 12, 139);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 999px) {
|
||||||
|
.logo {
|
||||||
|
width: 20vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 40vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<img :src="host + '/otherAssets/logo.png'" alt="Logo" class="logo">
|
||||||
|
<h1>There was an error whilst processing an order</h1>
|
||||||
|
<p>This order will have to be processed manually!</p>
|
||||||
|
<p>{{ order_id }}</p>
|
||||||
|
<p>{{ email }}</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
67
src/server/ui/en/payments/failedToProcessMail.html
Normal file
67
src/server/ui/en/payments/failedToProcessMail.html
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Two-Factor Authentication</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 80%;
|
||||||
|
height: 800px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ip {
|
||||||
|
color: rgb(94, 94, 94);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
width: 70vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify {
|
||||||
|
padding: 20px 30px;
|
||||||
|
background-color: rgb(0, 7, 87);
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
transition: 0.5s all;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify:hover {
|
||||||
|
background-color: rgb(0, 12, 139);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 999px) {
|
||||||
|
.logo {
|
||||||
|
width: 20vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 40vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<img :src="host + '/otherAssets/logo.png'" alt="Logo" class="logo">
|
||||||
|
<h1>There was an error whilst processing your order at {{ pageName }}</h1>
|
||||||
|
<p>Your tickets will have to be processed manually and you will receive them as soon as they are ready.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user