fix: note password compare

This commit is contained in:
Innei
2021-12-19 14:35:33 +08:00
parent 1bfc76b0ba
commit dddd7f3aa2
2 changed files with 2 additions and 3 deletions

View File

@@ -86,7 +86,7 @@ export class NoteController {
) {
const { id } = params
const { password } = query
const condition = addConditionToSeeHideContent(isMaster)
const condition = isMaster ? {} : { hide: false }
const current = await this.noteService.model
.findOne({
_id: id,

View File

@@ -1,6 +1,5 @@
import { Injectable } from '@nestjs/common'
import { DocumentType } from '@typegoose/typegoose'
import { compareSync } from 'bcrypt'
import { isDefined, isMongoId } from 'class-validator'
import { pick } from 'lodash'
import { FilterQuery } from 'mongoose'
@@ -77,7 +76,7 @@ export class NoteService {
if (!password) {
return false
}
const isValid = compareSync(password, doc.password)
const isValid = Object.is(password, doc.password)
return isValid
}