update api reset password additional parameter application
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Response, NextFunction, Application } from "express";
|
||||
import { Response, NextFunction } from "express";
|
||||
import { Request } from 'express-jwt'
|
||||
import { ReturnHelper } from "../helpers/express/return";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
@ -11,7 +11,7 @@ import dayjs from 'dayjs'
|
||||
import jwt from 'jsonwebtoken';
|
||||
import fs from 'fs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { EmailBody, Menu, User, UserRefreshToken, UserRole } from "entity";
|
||||
import { Application, EmailBody, Menu, User, UserRefreshToken, UserRole } from "entity";
|
||||
import axios from 'axios';
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { MoreThan } from "typeorm";
|
||||
@ -277,7 +277,7 @@ export class AuthController {
|
||||
application: Joi.string().required().label('Application'),
|
||||
});
|
||||
|
||||
const param: User = await schema.validateAsync(req.params);
|
||||
const param: { email: string, application: string } = await schema.validateAsync(req.params);
|
||||
|
||||
const userRepository = OrmHelper.DB.getRepository(User);
|
||||
|
||||
@ -296,8 +296,13 @@ export class AuthController {
|
||||
|
||||
const template_raw = fs.readFileSync('assets/reset_password.html').toString();
|
||||
|
||||
const appRepository = OrmHelper.DB.getRepository(Application);
|
||||
const app = await appRepository.findOneBy({ id: param.application })
|
||||
|
||||
|
||||
const pairMap = {
|
||||
'LINK': config.get('auth.reset_password_url') + user.reset_token,
|
||||
// 'LINK': config.get('auth.reset_password_url') + user.reset_token,
|
||||
'LINK': app.reset_password_url + user.reset_token,
|
||||
'NAME': user.name
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user