generate link for forgotten password
This commit is contained in:
17
forgotten_password.py
Normal file
17
forgotten_password.py
Normal file
@@ -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()
|
||||||
Reference in New Issue
Block a user