#!/bin/bash -x # Apply 2 patches to firstuseauthenticator.py # SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/python -m site | grep {{ jupyterhub_venv }} | grep /site-packages | cut -d\' -f2) SITE_PACKAGES=$({{ jupyterhub_venv }}/bin/getsite.py) file=$SITE_PACKAGES/firstuseauthenticator/firstuseauthenticator.py # e.g. /opt/iiab/jupyterhub/lib/python3.9/site-packages/firstuseauthenticator/firstuseauthenticator.py # (1) Add await to asyncio change password function: # https://github.com/iiab/iiab/issues/2918 == JupyterHub password-changing page shows "500 : Internal Server Error" # https://github.com/jupyterhub/firstuseauthenticator/issues/36 == 500 Error on path /hub/auth/change-password # https://github.com/jupyterhub/firstuseauthenticator/pull/37 == proposed fix to issue 36 sed -i 's/= self\.render/= await self.render/' $file # (2) https://github.com/jupyterhub/firstuseauthenticator/pull/38 == lowercase username to lock password sed -i "s/data\['username'\]$/&.lower()/" $file