use user
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2022-10-13 14:55:34 +02:00
parent acc88c8239
commit e240702884
1 changed files with 7 additions and 8 deletions

View File

@ -34,7 +34,7 @@ module.exports = Self => {
});
Self.afterRemote('create', async(ctx, instance) => {
console.log(instance);
/* console.log(instance);
const models = Self.app.models;
const userId = ctx.instance.id;
const loopBackContext = LoopBackContext.getCurrentContext();
@ -43,9 +43,6 @@ module.exports = Self => {
const headers = httpRequest.headers;
const origin = headers.origin;
const user = await models.User.findById(userId);
console.log(user);
const options = {
type: 'email',
to: 'alexm@verdnatura.es',
@ -58,8 +55,9 @@ module.exports = Self => {
protocol: 'https',
user: Self
};
await models.User.verify(options)
console.log('userId', userId);
const user = await models.user.findById(userId);
user.verify(options)
.then(res => console.log('> Verification email sent:', res));
/*
const changes = ctx.data || ctx.instance;
@ -115,7 +113,6 @@ module.exports = Self => {
});
Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => {
console.log(instance);
const models = Self.app.models;
const userId = ctx.instance.id;
const loopBackContext = LoopBackContext.getCurrentContext();
@ -136,7 +133,9 @@ module.exports = Self => {
protocol: 'https',
user: Self
};
await models.user.verify(options)
console.log(userId);
const user = await models.user.findById(userId);
user.verify(options)
.then(res => console.log('> Verification email sent:', res));
});