Merge branch 'master' into release
This commit is contained in:
commit
7e4118817f
@ -43,12 +43,12 @@ const hashPassword = async (pass = '') => {
|
|||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
const comparePassword = async (password = '', hash = '') => {
|
const comparePassword = async (password = '', hash = '') => {
|
||||||
if (typeof password !== 'string' || password.trim().length === 0) return null
|
if (typeof password !== 'string' || password.trim().length === 0) return false
|
||||||
if (typeof hash !== 'string' || hash.trim().length === 0) return null
|
if (typeof hash !== 'string' || hash.trim().length === 0) return false
|
||||||
let check = new Promise((resolve, reject) => {
|
let check = new Promise((resolve, reject) => {
|
||||||
bcrypt.compare(password, hash, (err, res) => {
|
bcrypt.compare(password, hash, (err, res) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err)
|
resolve(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resolve(res)
|
resolve(res)
|
||||||
|
Loading…
Reference in New Issue
Block a user