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

Method checkPassword

packages/hydrooj/src/model/user.ts:140–151  ·  view source on GitHub ↗
(password: string)

Source from the content-addressed store, hash-verified

138 }
139
140 async checkPassword(password: string) {
141 const h = global.Hydro.module.hash[this.hashType];
142 if (!h) throw new Error('Unknown hash method');
143 const result = await h(password, this._salt, this);
144 if (result !== true && result !== this._hash) {
145 throw new LoginError(this.uname);
146 }
147 if (this.hashType !== 'hydro') {
148 // eslint-disable-next-line ts/no-use-before-define
149 UserModel.setPassword(this._id, password);
150 }
151 }
152
153 async private() {
154 const user = await new User(this._udoc, this._dudoc, this.scope).init();

Callers 5

postMethod · 0.80
postMethod · 0.80
postMethod · 0.80
postChangePasswordMethod · 0.80
postChangeMailMethod · 0.80

Calls 1

setPasswordMethod · 0.80

Tested by

no test coverage detected