diff --git a/forgotten_password.py b/forgotten_password.py new file mode 100644 index 0000000..eb2b31a --- /dev/null +++ b/forgotten_password.py @@ -0,0 +1,17 @@ +import sys +from sqlmodel import Session, select +from cutt.security import set_password_token +from cutt.db import Player, TokenDB, engine + + +if len(sys.argv) > 1: + with Session(engine) as session: + for p in session.exec( + select(Player.username).where(Player.username == sys.argv[1].strip()) + ): + print(p) + token = set_password_token(p) + if token: + session.add(TokenDB(token=token)) + print(f"https://cutt.0124816.xyz/setpassword?token={token}") + session.commit()