fix: resolver problema de resolucion de modulo jwt y corregir lints de JobsView y service
This commit is contained in:
@@ -16,6 +16,7 @@ logger = logging.getLogger("uvicorn.error")
|
|||||||
@router.post("/login", response_model=TokenResponse)
|
@router.post("/login", response_model=TokenResponse)
|
||||||
async def login(credentials: LoginRequest, db: AsyncSession = Depends(get_db)):
|
async def login(credentials: LoginRequest, db: AsyncSession = Depends(get_db)):
|
||||||
email_clean = credentials.email.strip().lower()
|
email_clean = credentials.email.strip().lower()
|
||||||
|
|
||||||
result = await db.execute(select(User).where(User.email == email_clean))
|
result = await db.execute(select(User).where(User.email == email_clean))
|
||||||
user = result.scalar_one_or_none()
|
user = result.scalar_one_or_none()
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ def verify_password(plain_password: str, hashed_password: str) -> bool:
|
|||||||
"""Verifies a plain password against a bcrypt hash."""
|
"""Verifies a plain password against a bcrypt hash."""
|
||||||
try:
|
try:
|
||||||
return bcrypt.checkpw(plain_password.encode("utf-8"), hashed_password.encode("utf-8"))
|
return bcrypt.checkpw(plain_password.encode("utf-8"), hashed_password.encode("utf-8"))
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
print(f">> verify_password Exception: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def create_access_token(subject: Any, role: str = "ADMIN", expires_delta: Optional[timedelta] = None) -> str:
|
def create_access_token(subject: Any, role: str = "ADMIN", expires_delta: Optional[timedelta] = None) -> str:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
X,
|
X,
|
||||||
Edit2
|
Edit2
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { BackupJobItem, ClientItem, api, SystemSettingsResponse } from '../services/api';
|
import { BackupJobItem, ClientItem, api, SystemSettingsResponse, JobRunItem } from '../services/api';
|
||||||
|
|
||||||
interface JobsViewProps {
|
interface JobsViewProps {
|
||||||
jobs: BackupJobItem[];
|
jobs: BackupJobItem[];
|
||||||
@@ -45,7 +45,6 @@ export const JobsView: React.FC<JobsViewProps> = ({ jobs, clients, onRefresh, se
|
|||||||
const [selectedJobForRuns, setSelectedJobForRuns] = useState<BackupJobItem | null>(null);
|
const [selectedJobForRuns, setSelectedJobForRuns] = useState<BackupJobItem | null>(null);
|
||||||
const [runsHistory, setRunsHistory] = useState<JobRunItem[]>([]);
|
const [runsHistory, setRunsHistory] = useState<JobRunItem[]>([]);
|
||||||
const [loadingRuns, setLoadingRuns] = useState(false);
|
const [loadingRuns, setLoadingRuns] = useState(false);
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
|
|
||||||
const handleShowRuns = async (job: BackupJobItem) => {
|
const handleShowRuns = async (job: BackupJobItem) => {
|
||||||
setSelectedJobForRuns(job);
|
setSelectedJobForRuns(job);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import threading
|
|||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Callable, Dict, Any, List
|
from typing import Optional, Callable, Dict, Any, List
|
||||||
|
|||||||
Reference in New Issue
Block a user