diff --git a/reset_jupyter_password.py b/reset_jupyter_password.py index 7e14ce8..5aad8d8 100644 --- a/reset_jupyter_password.py +++ b/reset_jupyter_password.py @@ -1,6 +1,6 @@ import os # from IPython.lib import passwd -from hashlib import sha1 +from notebook.auth import passwd from jinja2 import Environment, FileSystemLoader from random import shuffle from getpass import getpass @@ -28,8 +28,7 @@ userdata['servername'] = servername password = getpass(f"New password: ") userdata['password'] = password -# userdata['password_sha1'] = passwd(password) -userdata['password_sha1'] = sha1(password.encode("utf-8")).hexdigest() +userdata['password_sha1'] = passwd(password) with open("jupyter_notebook_config.temp.py", "w") as f: print(nbconfig.render(**userdata), file=f)