freeCodeCamp/curriculum/challenges/arabic/06-information-security-and.../information-security-with-h.../hash-and-compare-passwords-...

1.0 KiB

id title challengeType videoUrl localeTitle
58a25bcff9fc0f352b528e7d Hash and Compare Passwords Asynchronously 2

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'getUserInput => $.get(getUserInput("url")+ "/_api/server.js") .then(data => { assert.match(data, /START_ASYNC[^]*bcrypt.hash.*myPlaintextPassword( |),( |)saltRounds( |),( |).*err( |),( |)hash[^]*END_ASYNC/gi, "You should call bcrypt.hash on myPlaintextPassword and saltRounds and handle err and hash as a result in the callback"); assert.match(data, /START_ASYNC[^]*bcrypt.hash[^]*bcrypt.compare.*myPlaintextPassword( |),( |)hash( |),( |).*err( |),( |)res[^]*}[^]*}[^]*END_ASYNC/gi, "Nested within the hash function should be the compare function comparing myPlaintextPassword to hash"); }, xhr => { throw new Error(xhr.statusText); })'

Challenge Seed

Solution

// solution required