mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-27 11:15:32 +02:00
refactor: rename AllEncompassingConfig to MediaManagerConfig
This commit is contained in:
@@ -20,11 +20,11 @@ from sqlalchemy import select, func
|
||||
import media_manager.notification.utils
|
||||
from media_manager.auth.db import User, get_user_db, get_async_session
|
||||
from media_manager.auth.schemas import UserUpdate, UserCreate
|
||||
from media_manager.config import AllEncompassingConfig
|
||||
from media_manager.config import MediaManagerConfig
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
config = AllEncompassingConfig().auth
|
||||
config = MediaManagerConfig().auth
|
||||
SECRET = config.token_secret
|
||||
LIFETIME = config.session_lifetime
|
||||
|
||||
@@ -66,7 +66,7 @@ class UserManager(UUIDIDMixin, BaseUserManager[User, uuid.UUID]):
|
||||
async def on_after_forgot_password(
|
||||
self, user: User, token: str, request: Optional[Request] = None
|
||||
):
|
||||
link = f"{AllEncompassingConfig().misc.frontend_url}web/login/reset-password?token={token}"
|
||||
link = f"{MediaManagerConfig().misc.frontend_url}web/login/reset-password?token={token}"
|
||||
log.info(f"User {user.id} has forgot their password. Reset Link: {link}")
|
||||
|
||||
if not config.email_password_resets:
|
||||
@@ -128,7 +128,7 @@ async def create_default_admin_user():
|
||||
stmt = select(func.count(User.id))
|
||||
result = await session.execute(stmt)
|
||||
user_count = result.scalar()
|
||||
config = AllEncompassingConfig()
|
||||
config = MediaManagerConfig()
|
||||
if user_count == 0:
|
||||
log.info(
|
||||
"No users found in database. Creating default admin user..."
|
||||
@@ -184,7 +184,7 @@ def get_jwt_strategy() -> JWTStrategy[models.UP, models.ID]:
|
||||
class RedirectingCookieTransport(CookieTransport):
|
||||
async def get_login_response(self, token: str) -> Response:
|
||||
response = RedirectResponse(
|
||||
str(AllEncompassingConfig().misc.frontend_url) + "web/dashboard",
|
||||
str(MediaManagerConfig().misc.frontend_url) + "web/dashboard",
|
||||
status_code=status.HTTP_302_FOUND,
|
||||
)
|
||||
return self._set_login_cookie(response, token)
|
||||
|
||||
Reference in New Issue
Block a user