MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / prepare

Method prepare

packages/hydrooj/src/handler/user.ts:296–303  ·  view source on GitHub ↗
({ }, code: string)

Source from the content-addressed store, hash-verified

294
295 @param('code', Types.String)
296 async prepare({ }, code: string) {
297 this.tdoc = await token.get(code, token.TYPE_REGISTRATION);
298 if (!this.tdoc?.identity) {
299 // prevent brute forcing tokens
300 await this.limitRate('user_register_with_code', 60, 5);
301 throw new InvalidTokenError(token.TYPE_TEXTS[token.TYPE_REGISTRATION], code);
302 }
303 }
304
305 async get() {
306 this.response.template = 'user_register_with_code.html';

Callers

nothing calls this directly

Calls 2

limitRateMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected