reset totp
This commit is contained in:
parent
48a8d1fb45
commit
fa1eb6a5f0
14 changed files with 354 additions and 83 deletions
26
src/service/resetService.ts
Normal file
26
src/service/resetService.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { reset } from "../entity/reset";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
|
||||
export default abstract class ResetService {
|
||||
/**
|
||||
* @description get reset by id
|
||||
* @param mail string
|
||||
* @param token string
|
||||
* @returns {Promise<reset>}
|
||||
*/
|
||||
static async getByMailAndToken(mail: string, token: string): Promise<reset> {
|
||||
return await dataSource
|
||||
.getRepository(reset)
|
||||
.createQueryBuilder("reset")
|
||||
.where("reset.mail = :mail", { mail: mail })
|
||||
.andWhere("reset.token = :token", { token: token })
|
||||
.getOneOrFail()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("reset not found by mail and token", err);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue