This commit is contained in:
AdisakKanthawilang 2024-11-21 17:32:31 +07:00
parent 522de9a7da
commit d01ca5f061
2 changed files with 30 additions and 29 deletions

View file

@ -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
*