fix(recover-password): use pint/Email
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
e80197bd6f
commit
2e36164a98
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
|
||||
const url = `${origin}/#!/account/${user.id}/basic-data?access_token=${token.id}`;
|
||||
const params = {
|
||||
recipient: 'alexm@verdnatura.es',
|
||||
recipient: email,
|
||||
url: url
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||
const md5 = require('md5');
|
||||
const app = require('../../loopback/server/server.js');
|
||||
const dataSources = require('../../loopback/server/datasources.json');
|
||||
const dataSources = require('../../print/config/print.json');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {Email} = require('vn-print');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/account/login')(Self);
|
||||
|
@ -62,19 +63,30 @@ module.exports = Self => {
|
|||
const url = app.get('rootUrl') || app.get('url');
|
||||
console.log(app.get('rootUrl'));
|
||||
console.log(app.get('url'));
|
||||
console.log(dataSources);
|
||||
const options = {
|
||||
type: 'email',
|
||||
to: instance.email,
|
||||
from: 'dataSources.email.settings.transports[0].auth.from',
|
||||
to: 'alexm@verdnatura.es',
|
||||
from: dataSources.app.senderEmail,
|
||||
subject: title,
|
||||
template: body,
|
||||
redirect: `${origin}#/login/${instance.email}?emailConfirmed`,
|
||||
host: url.hostname,
|
||||
port: url.port,
|
||||
protocol: url.protocol.split(':')[0],
|
||||
host: dataSources.smtp.host,
|
||||
port: dataSources.smtp.port,
|
||||
protocol: 'https',
|
||||
user: Self
|
||||
};
|
||||
instance.verify(options);
|
||||
|
||||
const params = {
|
||||
recipient: 'alexm@verdnatura.es',
|
||||
url: `${origin}/#!/verified`
|
||||
};
|
||||
|
||||
console.log(params);
|
||||
const sendEmail = new Email('email-verify', params);
|
||||
|
||||
// ctx.instance.verify(options);
|
||||
sendEmail.send();
|
||||
});
|
||||
|
||||
Self.remoteMethod('getCurrentUserData', {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||
|
||||
const path = require('path');
|
||||
const vnPrintPath = path.resolve('print');
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${vnPrintPath}/common/css/spacing.css`,
|
||||
`${vnPrintPath}/common/css/misc.css`,
|
||||
`${vnPrintPath}/common/css/layout.css`,
|
||||
`${vnPrintPath}/common/css/email.css`,
|
||||
`${__dirname}/style.css`])
|
||||
.mergeStyles();
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
.external-link {
|
||||
border: 2px dashed #8dba25;
|
||||
border-radius: 3px;
|
||||
text-align: center
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html v-bind:lang="$i18n.locale">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>{{ $t('subject') }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<table class="grid">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Empty block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block empty"></div>
|
||||
</div>
|
||||
<!-- Header block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block">
|
||||
<email-header></email-header>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block vn-pa-ml">
|
||||
<p>
|
||||
{{ $t(`Click on the following link to verify this email. If you haven't requested this email, just ignore it.`) }}
|
||||
<a :href="url">{{ $t('subject') }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block">
|
||||
<email-footer></email-footer>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Empty block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block empty"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const emailHeader = new Component('email-header');
|
||||
const emailFooter = new Component('email-footer');
|
||||
|
||||
module.exports = {
|
||||
name: 'recover-password',
|
||||
components: {
|
||||
'email-header': emailHeader.build(),
|
||||
'email-footer': emailFooter.build()
|
||||
},
|
||||
props: {
|
||||
url: {
|
||||
type: [String],
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
subject: Verificar correo
|
||||
title: Verificar correo
|
||||
Click on the following link to verify this email. If you haven't requested this email, just ignore it: Click on the following link to verify this email. If you haven't requested this email, just ignore it,
|
Loading…
Reference in New Issue