try
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
bcfbeb7032
commit
41d2d14d39
|
@ -4,6 +4,8 @@ const app = require('../../loopback/server/server.js');
|
|||
const dataSources = require('../../loopback/server/datasources.json');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const path = require('path');
|
||||
// const {Email} = require('vn-print');
|
||||
// const qs = require('querystring');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/account/login')(Self);
|
||||
|
@ -71,21 +73,50 @@ module.exports = Self => {
|
|||
const origin = headers.origin;
|
||||
|
||||
const userId = ctx.instance.id;
|
||||
const user = await models.user.findById(userId);
|
||||
|
||||
/* //generate verification url
|
||||
const generateVerificationToken = models.User.generateVerificationToken(user);
|
||||
verifyOptions.verifyHref =
|
||||
verifyOptions.protocol +
|
||||
'://' +
|
||||
verifyOptions.host +
|
||||
displayPort +
|
||||
urlPath +
|
||||
'?' + qs.stringify({
|
||||
uid: '' + verifyOptions.user[pkName],
|
||||
redirect: verifyOptions.redirect,
|
||||
});
|
||||
verifyOptions.verifyHref +=
|
||||
verifyOptions.verifyHref.indexOf('?') === -1 ? '?' : '&';
|
||||
verifyOptions.verifyHref += 'token=' + user.verificationToken;
|
||||
|
||||
verifyOptions.verificationToken = user.verificationToken;
|
||||
verifyOptions.text = verifyOptions.text || g.f('Please verify your email by opening ' +
|
||||
'this link in a web browser:\n\t%s', verifyOptions.verifyHref);
|
||||
verifyOptions.text = verifyOptions.text.replace(/\{href\}/g, verifyOptions.verifyHref);
|
||||
const email = new Email('email-verify', {
|
||||
recipient: instance.email,
|
||||
lang: ctx.req.getLocale(),
|
||||
url:
|
||||
});
|
||||
await email.send();
|
||||
*/
|
||||
const options = {
|
||||
type: 'email',
|
||||
to: instance.email,
|
||||
from: dataSources.email.transports[0].auth.from,
|
||||
from: 'test@test.es', // dataSources.email.transports[0].auth.from,
|
||||
subject: 'Verify email',
|
||||
template: path.resolve(__dirname, '../views/verify.ejs'),
|
||||
template: path.resolve(__dirname, '../views/verify.ejs'), // user.country.code = 'es' ? verifyES.ejs : verify.ejs
|
||||
redirect: `${origin}/#!/account/${instance.id}/basic-data?emailConfirmed`,
|
||||
host: origin.split(':')[1].split('/')[2],
|
||||
port: origin.split(':')[2],
|
||||
protocol: origin.split(':')[0],
|
||||
user: Self
|
||||
};
|
||||
console.log(options);
|
||||
|
||||
const user = await models.user.findById(userId);
|
||||
await user.verify(options);
|
||||
// await user.verify(options);
|
||||
});
|
||||
|
||||
Self.remoteMethod('getCurrentUserData', {
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
<p>
|
||||
Thanks for registering,
|
||||
</p>
|
||||
<p>
|
||||
Click <a href="<%=verifyHref%>">here</a> to confirm your email address.
|
||||
</p>
|
|
@ -3,7 +3,7 @@ const emailHeader = new Component('email-header');
|
|||
const emailFooter = new Component('email-footer');
|
||||
|
||||
module.exports = {
|
||||
name: 'recover-password',
|
||||
name: 'email-verify',
|
||||
components: {
|
||||
'email-header': emailHeader.build(),
|
||||
'email-footer': emailFooter.build()
|
||||
|
|
Loading…
Reference in New Issue