mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-20 00:54:19 +02:00
replace all the other config usages with allencompassing config
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import logging
|
||||
import os
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
@@ -17,22 +16,18 @@ from fastapi.responses import RedirectResponse, Response
|
||||
from starlette import status
|
||||
|
||||
import media_manager.notification.utils
|
||||
from media_manager.auth.config import AuthConfig, OpenIdConfig
|
||||
from media_manager.auth.db import User, get_user_db
|
||||
from media_manager.auth.schemas import UserUpdate
|
||||
from media_manager.config import AllEncompassingConfig
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
config = AuthConfig()
|
||||
config = AllEncompassingConfig().auth
|
||||
SECRET = config.token_secret
|
||||
LIFETIME = config.session_lifetime
|
||||
|
||||
if (
|
||||
os.getenv("OPENID_ENABLED") is not None
|
||||
and os.getenv("OPENID_ENABLED").upper() == "TRUE"
|
||||
):
|
||||
openid_config = OpenIdConfig()
|
||||
if config.openid_connect.enabled:
|
||||
openid_config = AllEncompassingConfig().auth.openid_connect
|
||||
openid_client = OpenID(
|
||||
base_scopes=["openid", "email", "profile"],
|
||||
client_id=openid_config.client_id,
|
||||
@@ -51,7 +46,7 @@ class UserManager(UUIDIDMixin, BaseUserManager[User, uuid.UUID]):
|
||||
|
||||
async def on_after_register(self, user: User, request: Optional[Request] = None):
|
||||
log.info(f"User {user.id} has registered.")
|
||||
if user.email in config.admin_email:
|
||||
if user.email in config.admin_emails:
|
||||
updated_user = UserUpdate(is_superuser=True, is_verified=True)
|
||||
await self.update(user=user, user_update=updated_user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user