Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

34 řádky
1.2KB

  1. <%
  2. '=======================================================================================================================
  3. ' PASSWORD HELPERS (native G3CRYPTO: bcrypt)
  4. '=======================================================================================================================
  5. ' Replaces the old PowerShell/SHA-256 shell-out, which cannot run on AxonASP/Linux and put the password on a
  6. ' command line. Stored hashes are bcrypt ("$2a$..."), so previously stored SHA-256 hashes will not verify; reset them.
  7. Function HashPassword(password)
  8. Dim crypto
  9. Set crypto = Server.CreateObject("G3CRYPTO")
  10. HashPassword = crypto.HashPassword(password)
  11. Set crypto = Nothing
  12. End Function
  13. ' Returns True when username exists in Users and password matches its stored hash.
  14. Function CheckPassword(username, password)
  15. Dim crypto, rs, storedHash
  16. CheckPassword = False
  17. Set rs = DAL().Query("SELECT PasswordHash FROM Users WHERE UserName = ?", username)
  18. If rs.EOF Then
  19. rs.Close
  20. Exit Function
  21. End If
  22. storedHash = "" & rs("PasswordHash")
  23. rs.Close
  24. Set rs = Nothing
  25. Set crypto = Server.CreateObject("G3CRYPTO")
  26. CheckPassword = crypto.VerifyPassword(password, storedHash)
  27. Set crypto = Nothing
  28. End Function
  29. %>

Powered by TurnKey Linux.