From 68984c499eefb179a745aeafe197a4c9d85553b3 Mon Sep 17 00:00:00 2001 From: Anton Afanasyeu Date: Tue, 23 Jun 2026 12:29:35 +0200 Subject: [PATCH] initial --- README.md | 3 ++ composer.json | 19 +++++++ public/assets/js/two_factor.js | 66 +++++++++++++++++++++++ public/index.php | 2 + views/account_security.php | 69 +++++++++++++++++++++++++ views/login.php | 58 +++++++++++++++++++++ views/partials/console_home_landing.php | 58 +++++++++++++++++++++ views/partials/console_quick_links.php | 37 +++++++++++++ views/partials/cookie_consent.php | 15 ++++++ views/register.php | 53 +++++++++++++++++++ views/two_factor_challenge.php | 53 +++++++++++++++++++ views/verify_email.php | 33 ++++++++++++ 12 files changed, 466 insertions(+) create mode 100644 README.md create mode 100644 composer.json create mode 100644 public/assets/js/two_factor.js create mode 100644 public/index.php create mode 100644 views/account_security.php create mode 100644 views/login.php create mode 100644 views/partials/console_home_landing.php create mode 100644 views/partials/console_quick_links.php create mode 100644 views/partials/cookie_consent.php create mode 100644 views/register.php create mode 100644 views/two_factor_challenge.php create mode 100644 views/verify_email.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..4332388 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ac-be-auth + +Thin BE UI. Remote: `git://f0xx.org/ac/ac-be-auth` diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..765047a --- /dev/null +++ b/composer.json @@ -0,0 +1,19 @@ +{ + "name": "androidcast/be-auth", + "description": "Login/register shell", + "require": { + "php": ">=8.1", + "androidcast/platform-php": "dev-next", + "androidcast/platform-web": "dev-next" + }, + "repositories": [ + { + "type": "vcs", + "url": "git://f0xx.org/ac/ac-platform-php" + }, + { + "type": "vcs", + "url": "git://f0xx.org/ac/ac-platform-web" + } + ] +} diff --git a/public/assets/js/two_factor.js b/public/assets/js/two_factor.js new file mode 100644 index 0000000..3e5ec56 --- /dev/null +++ b/public/assets/js/two_factor.js @@ -0,0 +1,66 @@ +(function () { + 'use strict'; + + function boot() { + var form = document.querySelector('form.login-card'); + var input = document.getElementById('twofa-code-input'); + if (!form || !input) { + return; + } + input.focus(); + input.select(); + + function digitsOnly(val) { + return String(val || '').replace(/\D/g, '').slice(0, 6); + } + + function maybeSubmit() { + if (input.value.length === 6) { + if (typeof form.requestSubmit === 'function') { + form.requestSubmit(); + } else { + form.submit(); + } + } + } + + input.addEventListener('input', function () { + var next = digitsOnly(input.value); + if (next !== input.value) { + input.value = next; + } + maybeSubmit(); + }); + + input.addEventListener('paste', function (ev) { + ev.preventDefault(); + var text = (ev.clipboardData && ev.clipboardData.getData('text')) || ''; + input.value = digitsOnly(text); + maybeSubmit(); + }); + + document.addEventListener('keydown', function (ev) { + if (!/^[0-9]$/.test(ev.key)) { + return; + } + var ae = document.activeElement; + if (ae === input) { + return; + } + var tag = ae && ae.tagName ? ae.tagName.toLowerCase() : ''; + if (tag === 'input' || tag === 'textarea' || tag === 'select' || (ae && ae.isContentEditable)) { + return; + } + ev.preventDefault(); + input.focus(); + input.value = digitsOnly(input.value + ev.key); + maybeSubmit(); + }); + } + + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', boot); + } else { + boot(); + } +})(); diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..e8271bc --- /dev/null +++ b/public/index.php @@ -0,0 +1,2 @@ + + + + + + + Account security β€” <?= h(cfg('app_name')) ?> + + + + + +
+

Account security

+

+ +
+ + +
+ + + +

Authenticator app is enrolled.

+
+ + +
+ +

Scan this QR code with your authenticator app, then enter a code to confirm.

+ +

TOTP QR

+ +
+ Can’t scan? + +
+
+ + + +
+ +

Protect your account with a 6-digit authenticator app (recommended for alpha).

+
+ + +
+ + +

Back to console

+
+ + + diff --git a/views/login.php b/views/login.php new file mode 100644 index 0000000..ddc7932 --- /dev/null +++ b/views/login.php @@ -0,0 +1,58 @@ + + * Commit: 5d8e82d2e60a21fff3138d2a394ee4e8b4c6dcb8 + * Contributors: + * - Anton Afanasyeu (2 commits, 27 lines) + * - Cursor Agent (project assistant) + * Digest: SHA256 9bef983f4d34cb790922cda355ccf5d14b565b29273d2ebfe48b3173cd2e8f9f + */ +$bp = Auth::basePath(); +$auth = Auth::authUrl(); +?> + + + + + + Login β€” <?= h(cfg('app_name')) ?> + + + + + + + + + + + diff --git a/views/partials/console_home_landing.php b/views/partials/console_home_landing.php new file mode 100644 index 0000000..b8d660a --- /dev/null +++ b/views/partials/console_home_landing.php @@ -0,0 +1,58 @@ + +
+
+

Console

+
+ +
+
+

Issue triage, tickets, and session metrics β€” pick a workspace below.

+ + + +

All services

+ +
diff --git a/views/partials/console_quick_links.php b/views/partials/console_quick_links.php new file mode 100644 index 0000000..9106fd4 --- /dev/null +++ b/views/partials/console_quick_links.php @@ -0,0 +1,37 @@ + + * @var bool $skip_home_link omit "Console home" (use on home view) + */ +$bp = Auth::basePath(); +$proj = '/app/androidcast_project'; +$navClass = 'console-quick-links graphs-quick-links' . (isset($extra_class) ? ' ' . $extra_class : ''); +$items = []; +if (empty($skip_home_link)) { + $items[] = ['Console home', $bp . '/?view=home', 'nav-icon--home']; +} +$items[] = ['Issues', $bp . '/?view=reports', 'nav-icon--reports']; +$items[] = ['Tickets', $bp . '/?view=tickets', 'nav-icon--tickets']; +if (Rbac::can('remote_access_view')) { + $items[] = ['Remote access', $bp . '/?view=remote_access', 'nav-icon--remote']; +} +if (Rbac::can('short_links_view')) { + $items[] = ['Short links', $bp . '/?view=short_links', 'nav-icon--link']; +} +if (Rbac::canManageRbac()) { + $items[] = ['Access control', $bp . '/?view=rbac', 'nav-icon--tickets']; +} +$items[] = ['Graphs', $proj . '/graphs/', 'nav-icon--graphs']; +$items[] = ['Builder', $proj . '/build/', 'nav-icon--builder']; +$items[] = ['Hub', $proj . '/', 'nav-icon--home']; +?> + diff --git a/views/partials/cookie_consent.php b/views/partials/cookie_consent.php new file mode 100644 index 0000000..0a0e5ed --- /dev/null +++ b/views/partials/cookie_consent.php @@ -0,0 +1,15 @@ + + diff --git a/views/register.php b/views/register.php new file mode 100644 index 0000000..100252b --- /dev/null +++ b/views/register.php @@ -0,0 +1,53 @@ + + + + + + + Register β€” <?= h(cfg('app_name')) ?> + + + + + + + + + + + diff --git a/views/two_factor_challenge.php b/views/two_factor_challenge.php new file mode 100644 index 0000000..e3a96ea --- /dev/null +++ b/views/two_factor_challenge.php @@ -0,0 +1,53 @@ + + + + + + + Two-factor β€” <?= h(cfg('app_name')) ?> + + + + + + + + + + + diff --git a/views/verify_email.php b/views/verify_email.php new file mode 100644 index 0000000..d6f0871 --- /dev/null +++ b/views/verify_email.php @@ -0,0 +1,33 @@ + + + + + + + Verify email β€” <?= h(cfg('app_name')) ?> + + + + + + + + +