Add Remote DNS
This commit is contained in:
+21
-23
@@ -5,9 +5,7 @@ from PyQt6.QtWidgets import (
|
||||
from PyQt6.QtCore import Qt, QTimer
|
||||
from PyQt6.QtGui import QFont
|
||||
from app.core import mfa as mfa_core
|
||||
|
||||
_DARK = "#1c2833"
|
||||
_DARK2 = "#17202a"
|
||||
from app.ui import theme
|
||||
|
||||
|
||||
class MFADialog(QDialog):
|
||||
@@ -19,8 +17,8 @@ class MFADialog(QDialog):
|
||||
self.setFixedWidth(340)
|
||||
self.setModal(True)
|
||||
self.setStyleSheet(f"""
|
||||
QDialog {{ background: {_DARK2}; }}
|
||||
QLabel {{ color: white; background: transparent; }}
|
||||
QDialog {{ background: {theme.BG_SUNKEN}; }}
|
||||
QLabel {{ color: {theme.TEXT}; background: transparent; }}
|
||||
""")
|
||||
self._build_ui()
|
||||
self._timer = QTimer(self)
|
||||
@@ -44,12 +42,12 @@ class MFADialog(QDialog):
|
||||
sub = QLabel("Entrez le code à 6 chiffres de votre application d'authentification.")
|
||||
sub.setWordWrap(True)
|
||||
sub.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
sub.setStyleSheet("color: rgba(255,255,255,0.6);")
|
||||
sub.setStyleSheet(f"color: {theme.TEXT_MUTED};")
|
||||
layout.addWidget(sub)
|
||||
|
||||
sep = QFrame()
|
||||
sep.setFrameShape(QFrame.Shape.HLine)
|
||||
sep.setStyleSheet("color: rgba(255,255,255,0.15);")
|
||||
sep.setStyleSheet(f"color: {theme.BORDER_SOFT};")
|
||||
layout.addWidget(sep)
|
||||
|
||||
self._code_input = QLineEdit()
|
||||
@@ -60,15 +58,15 @@ class MFADialog(QDialog):
|
||||
f2.setLetterSpacing(QFont.SpacingType.AbsoluteSpacing, 4)
|
||||
self._code_input.setFont(f2)
|
||||
self._code_input.setStyleSheet(
|
||||
"QLineEdit { padding: 8px; border: 2px solid #2471a3;"
|
||||
f" border-radius: 6px; background: {_DARK}; color: white; }}"
|
||||
f"QLineEdit {{ padding: 8px; border: 2px solid {theme.ACCENT};"
|
||||
f" border-radius: 6px; background: {theme.BG}; color: {theme.TEXT}; }}"
|
||||
)
|
||||
self._code_input.returnPressed.connect(self._verify)
|
||||
layout.addWidget(self._code_input)
|
||||
|
||||
self._error_label = QLabel("")
|
||||
self._error_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
self._error_label.setStyleSheet("color: #f1948a; font-weight: bold;")
|
||||
self._error_label.setStyleSheet(f"color: {theme.FAIL_TEXT}; font-weight: bold;")
|
||||
layout.addWidget(self._error_label)
|
||||
|
||||
self._progress = QProgressBar()
|
||||
@@ -76,31 +74,31 @@ class MFADialog(QDialog):
|
||||
self._progress.setTextVisible(False)
|
||||
self._progress.setFixedHeight(6)
|
||||
self._progress.setStyleSheet(
|
||||
f"QProgressBar {{ border-radius: 3px; background: {_DARK}; }}"
|
||||
"QProgressBar::chunk { background: #5dade2; border-radius: 3px; }"
|
||||
f"QProgressBar {{ border-radius: 3px; background: {theme.BG}; }}"
|
||||
f"QProgressBar::chunk {{ background: {theme.ACCENT_LIGHT}; border-radius: 3px; }}"
|
||||
)
|
||||
layout.addWidget(self._progress)
|
||||
|
||||
self._timer_label = QLabel("")
|
||||
self._timer_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
self._timer_label.setStyleSheet("color: #5d6d7e; font-size: 11px;")
|
||||
self._timer_label.setStyleSheet(f"color: {theme.TEXT_FAINT}; font-size: 11px;")
|
||||
layout.addWidget(self._timer_label)
|
||||
|
||||
btn_row = QHBoxLayout()
|
||||
btn_cancel = QPushButton("Annuler")
|
||||
btn_cancel.setStyleSheet(
|
||||
"QPushButton { padding: 8px 16px; border-radius: 5px; border: none;"
|
||||
f" background: #2e4057; color: white; }}"
|
||||
"QPushButton:hover { background: #3d5166; }"
|
||||
f"QPushButton {{ padding: 8px 16px; border-radius: 5px; border: none;"
|
||||
f" background: {theme.BG_RAISED}; color: {theme.TEXT}; }}"
|
||||
f"QPushButton:hover {{ background: {theme.ACCENT_HOVER}; }}"
|
||||
)
|
||||
btn_cancel.clicked.connect(self.reject)
|
||||
|
||||
self._btn_ok = QPushButton("Vérifier")
|
||||
self._btn_ok.setDefault(True)
|
||||
self._btn_ok.setStyleSheet(
|
||||
"QPushButton { padding: 8px 20px; border-radius: 5px; border: none;"
|
||||
" background: #2471a3; color: white; font-weight: bold; }"
|
||||
"QPushButton:hover { background: #1a5276; }"
|
||||
f"QPushButton {{ padding: 8px 20px; border-radius: 5px; border: none;"
|
||||
f" background: {theme.ACCENT}; color: {theme.TEXT}; font-weight: bold; }}"
|
||||
f"QPushButton:hover {{ background: {theme.ACCENT_HOVER}; }}"
|
||||
)
|
||||
self._btn_ok.clicked.connect(self._verify)
|
||||
btn_row.addWidget(btn_cancel)
|
||||
@@ -118,8 +116,8 @@ class MFADialog(QDialog):
|
||||
if len(raw) != 6 or not raw.isdigit():
|
||||
self._error_label.setText("Entrez exactement 6 chiffres.")
|
||||
self._code_input.setStyleSheet(
|
||||
f"QLineEdit {{ padding: 8px; border: 2px solid #f1948a;"
|
||||
f" border-radius: 6px; background: {_DARK}; color: white; }}"
|
||||
f"QLineEdit {{ padding: 8px; border: 2px solid {theme.FAIL_TEXT};"
|
||||
f" border-radius: 6px; background: {theme.BG}; color: {theme.TEXT}; }}"
|
||||
)
|
||||
return
|
||||
if mfa_core.verify_code(self._secret, raw):
|
||||
@@ -129,8 +127,8 @@ class MFADialog(QDialog):
|
||||
self._error_label.setText("Code incorrect. Réessayez.")
|
||||
self._code_input.clear()
|
||||
self._code_input.setStyleSheet(
|
||||
f"QLineEdit {{ padding: 8px; border: 2px solid #f1948a;"
|
||||
f" border-radius: 6px; background: {_DARK}; color: white; }}"
|
||||
f"QLineEdit {{ padding: 8px; border: 2px solid {theme.FAIL_TEXT};"
|
||||
f" border-radius: 6px; background: {theme.BG}; color: {theme.TEXT}; }}"
|
||||
)
|
||||
|
||||
def is_verified(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user