From a702769e0d6097f57c4c436e73ce91a4c7fbbe5a Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Tue, 4 Sep 2018 11:18:38 -0700 Subject: [PATCH 1/2] Clean password db when user is deleted This lets us 'reset passwords' by deleting the user account from the admin panel --- firstuseauthenticator/firstuseauthenticator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/firstuseauthenticator/firstuseauthenticator.py b/firstuseauthenticator/firstuseauthenticator.py index 91c2572..7325c06 100644 --- a/firstuseauthenticator/firstuseauthenticator.py +++ b/firstuseauthenticator/firstuseauthenticator.py @@ -65,3 +65,12 @@ class FirstUseAuthenticator(Authenticator): else: db[username] = bcrypt.hashpw(password.encode(), bcrypt.gensalt()) return username + + def delete_user(self, user): + """ + When user is deleted, remove their entry from password db. + + This lets passwords be reset by deleting users. + """ + with dbm.open(self.dbm_path, 'c', 0o600) as db: + del db[user.name] From 2a2676f836cbcdf4d2b58d20c15d1c32dfe53db8 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Tue, 4 Sep 2018 11:20:21 -0700 Subject: [PATCH 2/2] Bump version number --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2fb638a..a8500ff 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='jupyterhub-firstuseauthenticator', - version='0.10', + version='0.11', description='JupyterHub Authenticator that lets users set passwords on first use', url='https://github.com/yuvipanda/jupyterhub-firstuseauthenticator', author='Yuvi Panda',