(password: string)
| 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(); |
no test coverage detected