diff --git a/app/pages/credentials.php b/app/pages/credentials.php index 48498c3..c90d0d8 100644 --- a/app/pages/credentials.php +++ b/app/pages/credentials.php @@ -23,8 +23,11 @@ $item = $_REQUEST['item'] ?? ''; // if a form is submitted if ($_SERVER['REQUEST_METHOD'] == 'POST') { + // Ensure security helper is available + require_once '../app/helpers/security.php'; + $security = SecurityHelper::getInstance(); + // Validate CSRF token - $security->verifyCsrfToken($_POST['csrf_token'] ?? ''); if (!$security->verifyCsrfToken($_POST['csrf_token'] ?? '')) { Feedback::flash('ERROR', 'DEFAULT', 'Invalid security token. Please try again.'); header("Location: $app_root?page=credentials"); diff --git a/app/templates/credentials-2fa-setup.php b/app/templates/credentials-2fa-setup.php index 615314b..6f5eb91 100644 --- a/app/templates/credentials-2fa-setup.php +++ b/app/templates/credentials-2fa-setup.php @@ -4,94 +4,88 @@ */ ?> -
-
-
-
-
-

Set up two-factor authentication

-
-
-
-

Two-factor authentication adds an extra layer of security to your account. Once enabled, you'll need to enter both your password and a code from your authenticator app when signing in.

+
+
+

Security

+

Set up two-factor authentication

+

Protect your account with an extra verification step whenever you sign in.

+
+ +
+ Two-factor authentication adds an extra layer of protection. After setup, you will sign in with both your password and a code from your authenticator app. +
+ + +
+ +
+ + + +
+
+

1. Install an authenticator app

+

Use any TOTP-compatible app such as Google Authenticator, Microsoft Authenticator, or Authy.

+
+ +
+

2. Scan the QR code

+

Open your authenticator app and scan the QR code below.

+
+
+
+ Can't scan? Enter this code manually: +
- - -
- -
- - - -
-

1. Install an authenticator app

-

If you haven't already, install an authenticator app on your mobile device:

-
    -
  • Google Authenticator
  • -
  • Microsoft Authenticator
  • -
  • Authy
  • -
- -

2. Scan the QR code

-

Open your authenticator app and scan this QR code:

- -
-
-
- Can't scan? Use this code instead:
- -
-
- -

3. Verify setup

-

Enter the 6-digit code from your authenticator app to verify the setup:

- -
-
- -
- - - - - -
- -
-

Backup codes

-

- Important: Save these backup codes in a secure place. - If you lose access to your authenticator app, you can use these codes to sign in. - Each code can only be used once. -

-
- - - -
- -
-
- -
- Failed to generate 2FA setup data. Please try again. -
- Back to credentials -
+ +
+

3. Verify setup

+

Enter the 6-digit code shown in your authenticator app.

+
+
+ + +
+ + + + + +
+
+ +
+

Backup codes

+

+ Save these codes somewhere secure. Each code can be used once if you lose access to your authenticator app. +

+
+ + + +
+ +
-
+ +
+ Failed to generate 2FA setup data. Please try again. +
+ Back to credentials +
diff --git a/app/templates/credentials-2fa-verify.php b/app/templates/credentials-2fa-verify.php index 8705bf3..7096156 100644 --- a/app/templates/credentials-2fa-verify.php +++ b/app/templates/credentials-2fa-verify.php @@ -4,74 +4,70 @@ */ ?> -
-
-
-
-
-

Two-factor authentication

-
-
- -
- -
- +
+
+
+

Security check

+

Two-factor authentication

+

Enter the 6-digit code from your authenticator app to continue.

+
-

Enter the 6-digit code from your authenticator app:

- -
-
- -
- - - - -
- -
-

- Lost access to your authenticator app?
- - Use a backup code - -

- -
-
-
- - -
- - - - -
-
-
-
+ +
+
+ + +
+
+ + +
+ + + + +
+ +
+

Lost access to your authenticator app?

+ +
+ +
+
+
+ + +
+ + + + +
diff --git a/app/templates/credentials-manage.php b/app/templates/credentials-manage.php index c73f190..d16d607 100644 --- a/app/templates/credentials-manage.php +++ b/app/templates/credentials-manage.php @@ -5,88 +5,80 @@ */ ?> -
-
-
- -
-
-

change password

+
+
+

Security

+

Manage credentials

+

Update your password and keep two-factor authentication status in one place.

+
+ +
+
+
+
+

Change password

+

Choose a strong password to keep your account safe.

-
-
- + Required +
+ + -
- - -
- -
- - - minimum 8 characters -
- -
- - -
- -
- -
- +
+ +
+ +
+ + + Minimum 8 characters +
+ +
+ + +
+ + + +
+ +
+
+
+

Two-factor authentication

+

Strengthen security with a verification code from your authenticator app.

+
+ + +
- -
-
-

two-factor authentication

+ +
+ + Two-factor authentication is currently enabled.
-
-

Two-factor authentication adds an extra layer of security to your account. Once enabled, you'll need to enter both your password and a code from your authenticator app when signing in.

- - -
- two-factor authentication is enabled -
-
- - -
- -
- two-factor authentication is not enabled -
-
- - -
- +
+ + +
+ +
+ + Two-factor authentication is not enabled yet.
-
-
+
+ + +
+ +
diff --git a/public_html/static/css/main.css b/public_html/static/css/main.css index e68009d..9a9676a 100644 --- a/public_html/static/css/main.css +++ b/public_html/static/css/main.css @@ -5,10 +5,114 @@ html, body { padding: 0; } +/* Credentials management */ +.tm-cred-card { + max-width: 900px; + background: rgba(255,255,255,0.97); + border-radius: 1.5rem; + box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12); + padding: 2.5rem; + margin: 2.5rem auto; +} + +.tm-cred-intro { + border-radius: 1rem; + border: none; +} + +.tm-cred-steps { + display: flex; + flex-direction: column; + gap: 1.5rem; +} + +.tm-cred-step { + border: 1px solid rgba(148, 163, 184, 0.2); + border-radius: 1.2rem; + padding: 1.5rem; + background: rgba(248, 250, 252, 0.75); +} + +.tm-cred-qr { + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; + padding: 1.5rem; + border-radius: 1rem; + background: #fff; + border: 1px dashed rgba(148, 163, 184, 0.5); +} + +.tm-cred-secret code, +.tm-cred-backup code { + display: inline-block; + padding: 0.35rem 0.6rem; + border-radius: 0.6rem; + background: #0f172a; + color: #f8fafc; + font-weight: 600; + letter-spacing: 0.08em; +} + +.tm-cred-backup { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); + gap: 0.75rem; + padding: 1rem; + border-radius: 1rem; + background: #fff; + border: 1px solid rgba(148, 163, 184, 0.2); +} + +.tm-cred-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); + gap: 1.5rem; +} + +.tm-cred-panel { + border: 1px solid rgba(148, 163, 184, 0.25); + border-radius: 1.25rem; + padding: 1.5rem; + background: rgba(248, 250, 252, 0.75); +} + +.tm-cred-panel-head { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 1rem; + gap: 1rem; +} + +.tm-cred-panel-head h3 { + margin: 0; + font-size: 1.1rem; + font-weight: 600; +} + +.tm-cred-form .form-label { + font-size: 0.85rem; + text-transform: uppercase; + letter-spacing: 0.06em; +} + +.tm-cred-form .form-control { + border-radius: 0.85rem; + border: 1px solid rgba(148, 163, 184, 0.7); +} + +@media (max-width: 768px) { + .tm-cred-card { + padding: 2rem 1.5rem; + } +} + /* Profile form */ .tm-profile-card { max-width: 1100px; - margin: 2.5rem auto; + margin: 0rem auto 1.5rem; background: rgba(255, 255, 255, 0.97); border-radius: 1.5rem; box-shadow: 0 30px 70px rgba(15, 23, 42, 0.12);