From 82735d41fd112fabc207aaa81409456ed5c5eb52 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Fri, 8 Nov 2024 09:07:29 -0500 Subject: [PATCH] Work out some styles and move the register routes around. --- app/public/static/main.css | 8 +++++++- app/src/Controller/DashboardPage.php | 2 +- app/src/Controller/User/LoginUserAction.php | 2 +- app/src/Routes.php | 4 ++-- app/templates/layouts/skeleton.twig | 5 +++++ app/templates/user/login.twig | 2 +- app/templates/user/register.twig | 21 +++++++++++++++++++-- 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/app/public/static/main.css b/app/public/static/main.css index c1c9a98..97335fb 100644 --- a/app/public/static/main.css +++ b/app/public/static/main.css @@ -41,9 +41,15 @@ main { box-sizing: border-box; } -.error { +.flash { padding: 0.5em; + box-sizing: border-box; + margin-bottom: 1em; + color: #fff; +} +.error { border: 1px solid #140505; + border-radius: 5px; background-color: #C32727; } diff --git a/app/src/Controller/DashboardPage.php b/app/src/Controller/DashboardPage.php index 0ef3061..2ce81e5 100644 --- a/app/src/Controller/DashboardPage.php +++ b/app/src/Controller/DashboardPage.php @@ -17,6 +17,6 @@ class DashboardPage extends Controller { // get the user details // get the channels - return $this->render('dashboard.twig'); + return $this->render('dashboard.twig', [ 'session' => $this->session ]); } } diff --git a/app/src/Controller/User/LoginUserAction.php b/app/src/Controller/User/LoginUserAction.php index 81b58a6..31f4138 100644 --- a/app/src/Controller/User/LoginUserAction.php +++ b/app/src/Controller/User/LoginUserAction.php @@ -35,6 +35,6 @@ class LoginUserAction extends Controller // start the session $this->session->set('user', [ 'id' => $user->getId(), 'authenticated' => true ]); - return $this->render('dashboard.twig'); + return $this->render('dashboard.twig', [ 'logged_in' => true ]); } } diff --git a/app/src/Routes.php b/app/src/Routes.php index 8dcbfee..134deaa 100644 --- a/app/src/Routes.php +++ b/app/src/Routes.php @@ -33,9 +33,9 @@ class Routes */ protected static function users(App $app): void { - $app->get('/users/register', RegisterUserPage::class) + $app->get('/register', RegisterUserPage::class) ->setName('user-register-page'); - $app->post('/users/register', RegisterUserAction::class) + $app->post('/register', RegisterUserAction::class) ->add(VerifyPasswordMiddleware::class) ->setName('user-register-action'); diff --git a/app/templates/layouts/skeleton.twig b/app/templates/layouts/skeleton.twig index 1e01c87..d9e1013 100644 --- a/app/templates/layouts/skeleton.twig +++ b/app/templates/layouts/skeleton.twig @@ -7,6 +7,8 @@ {% endblock %} + + {% block head_js %}{% endblock %}
@@ -21,6 +23,7 @@
  • Dashboard
  • {% else %}
  • Login
  • +
  • Register
  • {% endif %} @@ -36,5 +39,7 @@ {% endblock %}
    + + {% block body_js %}{% endblock %} diff --git a/app/templates/user/login.twig b/app/templates/user/login.twig index 47a77ca..076d605 100644 --- a/app/templates/user/login.twig +++ b/app/templates/user/login.twig @@ -12,7 +12,7 @@
    - +
    diff --git a/app/templates/user/register.twig b/app/templates/user/register.twig index 013d423..18c11f7 100644 --- a/app/templates/user/register.twig +++ b/app/templates/user/register.twig @@ -2,7 +2,7 @@ {% block content %}
    -
    +
    - +
    {% endblock %} + +{% block body_js %} + +{% endblock %}