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

Method post

packages/hydrooj/src/handler/user.ts:390–398  ·  view source on GitHub ↗
(domainId: string, code: string, password: string, verifyPassword: string)

Source from the content-addressed store, hash-verified

388 @param('password', Types.Password)
389 @param('verifyPassword', Types.Password)
390 async post(domainId: string, code: string, password: string, verifyPassword: string) {
391 const tdoc = await token.get(code, token.TYPE_LOSTPASS);
392 if (!tdoc) throw new InvalidTokenError(token.TYPE_TEXTS[token.TYPE_LOSTPASS], code);
393 if (password !== verifyPassword) throw new VerifyPasswordError();
394 await user.setById(tdoc.uid, { authenticators: [], tfa: false });
395 await user.setPassword(tdoc.uid, password);
396 await token.del(code, token.TYPE_LOSTPASS);
397 this.response.redirect = this.url('homepage');
398 }
399}
400
401class UserDetailHandler extends Handler {

Callers

nothing calls this directly

Calls 5

setByIdMethod · 0.80
setPasswordMethod · 0.80
urlMethod · 0.80
getMethod · 0.45
delMethod · 0.45

Tested by

no test coverage detected