Skip to content
Snippets Groups Projects
Closed management console: update password reset docs for python 3.x
  • View options
  • management console: update password reset docs for python 3.x

  • View options
  • Closed Issue created by Warren Gifford

    Created by: ggilmore

    https://docs.sourcegraph.com/admin/management_console has a snippet to update the management console password that works in python 2.x:

    python -c "import bcrypt; import os; print(bcrypt.hashpw(os.environ['PASSWORD'], bcrypt.gensalt(15)))"
    

    However, you get an error when running the snippet in python 3.x,

    python -c "import bcrypt; import os; print(bcrypt.hashpw(os.environ['PASSWORD'], bcrypt.gensalt(15)))"
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.7/site-packages/bcrypt/__init__.py", line 61, in hashpw
        raise TypeError("Unicode-objects must be encoded before hashing")
    TypeError: Unicode-objects must be encoded before hashing

    According to a user, the following snippet fixes the issue in python 3.x

    python -c "import bcrypt; import os; print(bcrypt.hashpw(os.environ['PASSWORD'], bcrypt.gensalt(15)))"

    Linked items 0

  • Link items together to show that they're related.

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading