backend: Login/Inscription

This commit is contained in:
Divlo
2020-03-25 16:23:43 +01:00
parent 84712eb251
commit 2239df70b3
17 changed files with 461 additions and 8 deletions

View File

@ -1,5 +1,6 @@
const config = {
PORT: process.env.PORT || 8080,
HOST: process.env.HOST,
WEATHER_API_KEY: process.env.OpenWeatherMap_API_KEY,
DATABASE: {
host: process.env.DB_HOST,
@ -7,6 +8,16 @@ const config = {
user: process.env.DB_USER,
password: process.env.DB_PASS
},
JWT_SECRET: process.env.JWT_SECRET,
EMAIL_INFO: {
host: process.env.EMAIL_HOST,
port: 465,
secure: true, // true for 465, false for other ports
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASSWORD
}
}
};
module.exports = config;

View File

@ -0,0 +1,53 @@
exports.signupEmail = (url) => `
<center>
<table border="0" cellpadding="20" cellspacing="0" height="100%" width="100%" style="background-color:#eeeeee">
<tbody>
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;border-radius:6px;background-color:none">
<tbody>
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px">
<tbody>
<tr>
<td>
<h1 style="font-family:Arial, Helvetica, sans-serif;font-size:28px;line-height:110%;margin-bottom:30px;margin-top:0;padding:0">FunctionProject</h1>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;border-radius:6px;background-color:#ffffff">
<tbody>
<tr>
<td align="left" valign="top" style="line-height:150%;font-family:Helvetica;font-size:14px;color:#333333;padding:20px">
<h2 style="font-size:22px;line-height:28px;margin:0 0 12px 0">
Veuillez confirmer l'inscription
</h2>
<a href="${url}" style="color:#ffffff!important;display:inline-block;font-weight:500;font-size:16px;line-height:42px;font-family:'Helvetica',Arial,sans-serif;width:auto;white-space:nowrap;height:42px;margin:12px 5px 12px 0;padding:0 22px;text-decoration:none;text-align:center;border:0;border-radius:3px;vertical-align:top;background-color:#5d5d5d!important" target="_blank" rel="noopener noreferrer"><span
style="display:inline;font-family:'Helvetica',Arial,sans-serif;text-decoration:none;font-weight:500;font-style:normal;font-size:16px;line-height:42px;border:none;background-color:#5d5d5d!important;color:#ffffff!important">Oui, je m'inscris.</span></a>
<br>
<div>
<p style="padding:0 0 10px 0">Si vous avez reçu ce message
par erreur, il suffit de le supprimer. Vous ne serez pas
inscrit si vous ne cliquez pas sur le lien de
confirmation ci-dessus.</p>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
`;

View File

@ -0,0 +1,6 @@
const nodemailer = require('nodemailer');
const { EMAIL_INFO } = require('./config');
const transporter = nodemailer.createTransport(EMAIL_INFO);
module.exports = transporter;