diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-12 01:12:30 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-12 01:12:30 +0300 |
| commit | 5375e22de976b74f5f04d800014c30d9c66f0fe5 (patch) | |
| tree | 3f9d79b898c4bbb392c2a4ec5ec65c0fde5c6f01 /public/app/routes/frontend.php | |
| parent | 0b0076b2ece062f248b7c048d6bb28abbe9174a5 (diff) | |
| download | gyraf1gov-5375e22de976b74f5f04d800014c30d9c66f0fe5.tar.gz gyraf1gov-5375e22de976b74f5f04d800014c30d9c66f0fe5.tar.bz2 gyraf1gov-5375e22de976b74f5f04d800014c30d9c66f0fe5.zip | |
official Reliese Candidate; themes added; routes organized; fine tuning
Diffstat (limited to 'public/app/routes/frontend.php')
| -rw-r--r-- | public/app/routes/frontend.php | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/public/app/routes/frontend.php b/public/app/routes/frontend.php index 48d5da3..d58d483 100644 --- a/public/app/routes/frontend.php +++ b/public/app/routes/frontend.php @@ -1,51 +1,61 @@ <?php use app\controllers\Auth; -use app\controllers\App_user; -use app\controllers\Office; -use app\extends\Cache_service; // Home/Welcome //////////////////////////////////////////////////////////////////////////////// -// Route::add('/', function() { Render::view('welcome'); }); -Route::add('/', function() { Render::view('user/login'); }); +// welcome -> redirecto to login +Route::add('/', function() { header("Location: /login");; }); -// invitation +// Error pages //////////////////////////////////////////////////////////////////////////////// -// request invitation (for account activation) -// --- -- -- - - - -Route::add('/invitation/([0-9a-f]*)', function($id) { - if ($id == "" || $id == "0") { Render::view('error/404'); - } else { - Auth::invitation($id); - } +Route::notFound( function() { // 404 error page + header("HTTP/1.0 404 Not Found"); + Render::view('error/404', ['message' => 'nobody knows it (but you got a secret smile;)']); }); -// request activation (submit invitation; POST:form is sent) -// --- -- -- - - - -Route::add('/account/activate', function() { Auth::activate(); }, 'post'); -// DEPRICATED: user sends a registration form -// --- -- -- - - - -# Route::add('/account/register', function() { -# $response = Auth::register(); -# Render::json($response); -# },'post'); +// NOTE: this set of routes defines all valid NON-AUTHenticated requests +//////////////////////////////////////////////////////////////////////////////// +if (!Auth::is_connected()) { -// Error pages -//////////////////////////////////////////////////////////////////////////////// + // request login + // render Form -> will POST: /account/check-login + // --- -- -- - - - + Route::add('/login', function() { Render::view('user/login'); }); -Route::notFound( function() { // 404 error page - header("HTTP/1.0 404 Not Found"); - Render::view('error/404', ['message' => 'nobody knows it (but you got a secret smile;)']); -}); + + // user sends login form + // --- -- -- - - - + Route::add('/account/check-login', function() { + $response = Auth::login(); + Render::json(['status' => $response]); + }, 'post'); + + + // request invitation (for account activation) + // render Form -> will POST /account/activate + // --- -- -- - - - + Route::add('/invitation/([0-9a-f]*)', function($id) { + if ($id == "" || $id == "0") { Render::view('error/404'); + } else { + Auth::invitation($id); + } + }); + + + // POST invitation = activate + // --- -- -- - - - + Route::add('/account/activate', function() { Auth::activate(); }, 'post'); + +} |
