mirror of
https://github.com/michivonah/bbzw-horizon.git
synced 2025-12-22 17:16:27 +01:00
implement token generation endpoint
This commit is contained in:
parent
7f24ba04da
commit
b1d7363e81
6 changed files with 64 additions and 8 deletions
|
|
@ -50,4 +50,10 @@ def check_api_access(db: Session, token: str) -> bool:
|
|||
user = db.query(User).filter(User.id == session.userid).first()
|
||||
|
||||
# Überprüfe, ob api_access True ist
|
||||
return user.api_access if user else False # Gibt True oder False zurück
|
||||
return user.api_access if user else False # Gibt True oder False zurück
|
||||
|
||||
def save_token_to_db(db: Session, token: str, user_id: int, valid_until: datetime):
|
||||
new_session = SessionModel(token=token, validuntil=valid_until, userid=user_id)
|
||||
db.add(new_session)
|
||||
db.commit()
|
||||
db.refresh(new_session)
|
||||
Loading…
Add table
Add a link
Reference in a new issue