Announcement

Collapse
No announcement yet.

Re-authenticate Password

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Re-authenticate Password

    Hello,

    My application requires the user to re-authenticate their username and password. I imagine the query looks something like:
    SELECT * FROM `user` WHERE `password` = _______?
    Since the password in the database is encrypted, how would the rest of the query look like?

  • #2
    [PHP]
    $passwordHash = new PasswordHash($config);

    SELECT * FROM `user` WHERE `password` = $passwordHash->hash($password_text);[/HTML]
    CEO & Founder of Eblasoft.
    Professional EspoCRM development & extensions.

    Comment


    • #3
      I'm getting the following error message:
      Bad server response: <br />
      <b>Fatal error</b>: Uncaught Espo\Core\Exceptions\Error: Option &quot;passwordSalt&quot; does not exist in config.php in C:\Users\user\xampp\htdocs\EspoCRM\application\Esp o\Core\Utils\PasswordHash.php:84
      Stack trace:
      #0 C:\Users\user\xampp\htdocs\EspoCRM\application\Esp o\Core\Utils\PasswordHash.php(62): Espo\Core\Utils\PasswordHash-&gt;getSalt()
      #1 C:\Users\user\xampp\htdocs\EspoCRM\api\v1\password confirm.php(32): Espo\Core\Utils\PasswordHash-&gt;hash('password')
      #2 {main}
      thrown in <b>C:\Users\user\xampp\htdocs\EspoCRM\application\ Espo\Core\Utils\PasswordHash.php</b> on line <b>84</b><br />

      It says that 'passwordSalt' does not exist in config.php, but it does? Here's the code where I use it:

      Code:
      $fileM = new \Espo\Core\Utils\File\Manager();
      $config = new \Espo\Core\Utils\Config($fileM);
      $passwordHash = new \Espo\Core\Utils\PasswordHash($config);
      $hashedPassword = $passwordHash->hash($password);
      If I were to manually set the passwordSalt in PasswordHash.php, then it works, but that wouldn't be so good. Any advice?

      Comment

      Working...
      X