parent
ffcd45e572
commit
e7f0cb45c9
@ -55,12 +55,13 @@ export class RunnerSelfServiceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('/runners/me/forgot')
|
@Post('/runners/me/forgot')
|
||||||
@ResponseSchema(ResponseSelfServiceRunner, { isArray: true })
|
|
||||||
@ResponseSchema(RunnerNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerNotFoundError, { statusCode: 404 })
|
||||||
@OnUndefined(ResponseEmpty)
|
@OnUndefined(ResponseEmpty)
|
||||||
@OpenAPI({ description: 'TODO' })
|
@OpenAPI({ description: 'TODO' })
|
||||||
async requestNewToken(@QueryParam('mail') mail: string) {
|
async requestNewToken(@QueryParam('mail') mail: string) {
|
||||||
const runner = await this.runnerRepository.findOne({ email: mail });
|
const runner = await this.runnerRepository.findOne({ email: mail });
|
||||||
|
if (!runner) { throw new RunnerNotFoundError(); }
|
||||||
|
|
||||||
if (runner.resetRequestedTimestamp > (Math.floor(Date.now() / 1000) - 60 * 60 * 24)) { throw new Error("timeout!") }
|
if (runner.resetRequestedTimestamp > (Math.floor(Date.now() / 1000) - 60 * 60 * 24)) { throw new Error("timeout!") }
|
||||||
const token = JwtCreator.createSelfService(runner);
|
const token = JwtCreator.createSelfService(runner);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user