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

Method setPassword

packages/hydrooj/src/model/user.ts:298–307  ·  view source on GitHub ↗
(uid: number, password: string)

Source from the content-addressed store, hash-verified

296
297 @ArgMethod
298 static async setPassword(uid: number, password: string): Promise<Udoc> {
299 const salt = randomstring();
300 const res = await coll.findOneAndUpdate(
301 { _id: uid },
302 { $set: { salt, hash: await pwhash(password, salt), hashType: 'hydro' } },
303 { returnDocument: 'after' },
304 );
305 deleteUserCache(res);
306 return res;
307 }
308
309 @ArgMethod
310 static async inc(_id: number | number[], field: string, n: number = 1) {

Callers 5

applyFunction · 0.80
runFunction · 0.80
checkPasswordMethod · 0.80
postMethod · 0.80
postChangePasswordMethod · 0.80

Calls 2

randomstringFunction · 0.90
deleteUserCacheFunction · 0.85

Tested by

no test coverage detected