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