hmac1 Node.js] crypto 모듈로 비밀번호 암호화하기 password를 virtual 메소드로 정의한다. 몽고디비에는 비번값이 저장되지 않는다. 대신 해쉬처리된 비번이 저장된다. userSchema .virtual('password') .set(function (password) { console.log('레레레'); this._password = password; this.salt = this.makeSalt(); this.hashed_password = this.encryptPassword(password); console.log('virtual password set 호출됨 : ' + this.hashed_password); }) .get(function () { console.log('virtual password의 get 호출됨.'); return.. 2020. 1. 31. 이전 1 다음