4077-login_recover-password & account_verifyEmail #1063
|
@ -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);
|
||||
alexm marked this conversation as resolved
Outdated
|
||||
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));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Cridar al métode
User.verify()
com ací: