fix
This commit is contained in:
parent
522de9a7da
commit
d01ca5f061
2 changed files with 30 additions and 29 deletions
|
|
@ -11,6 +11,7 @@ import { calculateRetireDate } from "../interfaces/utils";
|
|||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
||||
@Route("api/v1/org/unauthorize")
|
||||
@Tags("OrganizationUnauthorize")
|
||||
|
|
@ -1123,4 +1124,33 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ยืนยัน Email
|
||||
*
|
||||
* @summary ยืนยัน Email
|
||||
*
|
||||
*/
|
||||
@Post("verify-email")
|
||||
async genLinkVerifyEmail(@Body() body: { token: string }) {
|
||||
const jwt = require("jsonwebtoken");
|
||||
const secretKey = process.env.AUTH_ACCOUNT_SECRET || "defaultSecretKey";
|
||||
const decodedToken = jwt.verify(body.token, secretKey);
|
||||
// console.log("[email]",decodedToken);
|
||||
// console.log("[1]",decodedToken.email_id);
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: {
|
||||
id: decodedToken.profileId,
|
||||
email: decodedToken.email_id,
|
||||
},
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||
}
|
||||
|
||||
Object.assign(profile, body);
|
||||
profile.statusEmail = "VERIFIED";
|
||||
await this.profileRepo.save(profile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1902,35 +1902,6 @@ export class ProfileController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ยืนยัน Email
|
||||
*
|
||||
* @summary ยืนยัน Email
|
||||
*
|
||||
*/
|
||||
@Post("verify-email")
|
||||
async genLinkVerifyEmail(@Body() body: { token: string }) {
|
||||
const jwt = require("jsonwebtoken");
|
||||
const secretKey = process.env.AUTH_ACCOUNT_SECRET || "defaultSecretKey";
|
||||
const decodedToken = jwt.verify(body.token, secretKey);
|
||||
// console.log("[email]",decodedToken);
|
||||
// console.log("[1]",decodedToken.email_id);
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: {
|
||||
id: decodedToken.profileId,
|
||||
email: decodedToken.email_id,
|
||||
},
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||
}
|
||||
|
||||
Object.assign(profile, body);
|
||||
profile.statusEmail = "VERIFIED";
|
||||
await this.profileRepo.save(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ออกคำสั่ง คำสั่งให้ข้าราชการที่มีผลการทดลองปฏิบัติหน้าที่ราชการไม่ต่ำกว่ามาตรฐานที่กำหนดรับราชการต่อไป
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue