4077-login_recover-password & account_verifyEmail #1063

Merged
alexm merged 52 commits from 4077-login_recover-password into dev 2022-11-28 11:34:03 +00:00
1 changed files with 7 additions and 8 deletions
Showing only changes of commit e240702884 - Show all commits

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);
alexm marked this conversation as resolved Outdated
Outdated
Review
Cridar al métode `User.verify()` com ací: * https://gitea.verdnatura.es/juan/hedera-web/src/branch/master/back/common/models/user.js#L22 * https://loopback.io/doc/en/lb2/Registering-users.html
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));
});