User registration added to menus and page tree.
This commit is contained in:
parent
ff205469cb
commit
bb315f3efb
24 changed files with 160 additions and 64 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,3 +15,4 @@ kanga.world/composer.json
|
||||||
kanga.world/index.php
|
kanga.world/index.php
|
||||||
kanga.world/site/config/config.php
|
kanga.world/site/config/config.php
|
||||||
kanga.world/content/home/*/
|
kanga.world/content/home/*/
|
||||||
|
kanga.world/content/1_home/*/
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
a:link:not(.dropdown-item), a:visited:not(.dropdown-item), a:hover:not(.dropdown-item), a:active:not(.dropdown-item) {
|
a:link:not(.dropdown-item):not(.nav-link),
|
||||||
|
a:visited:not(.dropdown-item):not(.nav-link),
|
||||||
|
a:hover:not(.dropdown-item):not(.nav-link),
|
||||||
|
a:active:not(.dropdown-item):not(.nav-link) {
|
||||||
color: #ff0000;
|
color: #ff0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
kanga.world/content/activated/activated.txt
Normal file
5
kanga.world/content/activated/activated.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Title: Activation Complete!
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Text: Your account is now active! Please login.
|
5
kanga.world/content/newuser/newuser.txt
Normal file
5
kanga.world/content/newuser/newuser.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Title: New User
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Text: Check your email for an activation link.
|
|
@ -1,4 +1,4 @@
|
||||||
Title: User Settings
|
Title: Profile
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -26,9 +26,8 @@ Danger: Danger Zone
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
Delete_Button: Delete Account
|
Delete-button: Delete Account
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
Delete_Warning: Are you sure? This action cannot be reversed!
|
Delete-warning: Are you sure? This action cannot be reversed!
|
||||||
|
|
7
kanga.world/site/blueprints/pages/activated.yml
Normal file
7
kanga.world/site/blueprints/pages/activated.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
title: Avtivated User Landing Page
|
||||||
|
preset: page
|
||||||
|
fields:
|
||||||
|
text:
|
||||||
|
label: Text
|
||||||
|
type: textarea
|
||||||
|
size: large
|
7
kanga.world/site/blueprints/pages/newuser.yml
Normal file
7
kanga.world/site/blueprints/pages/newuser.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
title: New User Landing Page
|
||||||
|
preset: page
|
||||||
|
fields:
|
||||||
|
text:
|
||||||
|
label: Text
|
||||||
|
type: textarea
|
||||||
|
size: large
|
|
@ -67,8 +67,8 @@ return [
|
||||||
if ($user = $kirby->users()->findBy('emailActivationToken', $token)) {
|
if ($user = $kirby->users()->findBy('emailActivationToken', $token)) {
|
||||||
if ($user->emailActivationToken()->toString() === Str::toType($token, 'string')) {
|
if ($user->emailActivationToken()->toString() === Str::toType($token, 'string')) {
|
||||||
$user->update(['emailActivation' => true]);
|
$user->update(['emailActivation' => true]);
|
||||||
go('user');
|
$kirby->session()->set('kpActivated', true);
|
||||||
//go('CUSTOM_SUCCESSFUL_ACTIVATION_PAGE');
|
go('/activated');
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
//go('CUSTOM_ERROR_ACTIVATION_PAGE');
|
//go('CUSTOM_ERROR_ACTIVATION_PAGE');
|
||||||
|
|
|
@ -93,10 +93,9 @@ return function ($kirby) {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOGIN USER
|
// Welcome new user.
|
||||||
if($user->login($data['password'])) {
|
$kirby->session()->set('kpNewUser', true);
|
||||||
go();
|
go('/newuser');
|
||||||
}
|
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,9 @@ Kirby::plugin('kangaroopunch/download-kirbytag', [
|
||||||
[
|
[
|
||||||
'pattern' => 'download/(:any)/(:any)',
|
'pattern' => 'download/(:any)/(:any)',
|
||||||
'action' => function($sourcepage, $filerequested) {
|
'action' => function($sourcepage, $filerequested) {
|
||||||
|
$file = "";
|
||||||
|
kirby()->impersonate('kirby');
|
||||||
|
try {
|
||||||
// Unmuddle the page ID that called us.
|
// Unmuddle the page ID that called us.
|
||||||
$slug = str_rot13(urldecode($sourcepage));
|
$slug = str_rot13(urldecode($sourcepage));
|
||||||
$slug = str_replace('|', '/', $slug);
|
$slug = str_replace('|', '/', $slug);
|
||||||
|
@ -24,6 +27,10 @@ Kirby::plugin('kangaroopunch/download-kirbytag', [
|
||||||
// Update download count.
|
// Update download count.
|
||||||
$count++;
|
$count++;
|
||||||
$file->update([ 'downloads' => $count ]);
|
$file->update([ 'downloads' => $count ]);
|
||||||
|
} catch (Exception $ex){
|
||||||
|
$file = $ex->getMessage();
|
||||||
|
}
|
||||||
|
kirby()->impersonate();
|
||||||
// Send file to user.
|
// Send file to user.
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
@ -37,13 +44,16 @@ Kirby::plugin('kangaroopunch/download-kirbytag', [
|
||||||
'desc'
|
'desc'
|
||||||
],
|
],
|
||||||
'html' => function($tag) {
|
'html' => function($tag) {
|
||||||
|
try {
|
||||||
// Did we get a valid file?
|
// Did we get a valid file?
|
||||||
$file = $tag->file($tag->value());
|
$file = $tag->file($tag->value());
|
||||||
if (!$file === true) {
|
if (!$file === true) {
|
||||||
return '<div class="downloadlinkerror">ERROR: Cannot locate "' . $tag->value() . '"!</div>';
|
return '<div class="downloadlinkerror">ERROR: Cannot locate "' . $tag->value() . '"!</div>';
|
||||||
}
|
}
|
||||||
// Ensure we're using the proper blueprint.
|
// Ensure we're using the proper blueprint.
|
||||||
//$file->update([ 'template' => 'download' ]);
|
kirby()->impersonate('kirby');
|
||||||
|
$file->update([ 'template' => 'download' ]);
|
||||||
|
kirby()->impersonate();
|
||||||
// Did they provide a description?
|
// Did they provide a description?
|
||||||
if (is_null($tag->desc) === true) {
|
if (is_null($tag->desc) === true) {
|
||||||
// No. Does the file itself have one?
|
// No. Does the file itself have one?
|
||||||
|
@ -66,6 +76,9 @@ Kirby::plugin('kangaroopunch/download-kirbytag', [
|
||||||
// Muddle up the page slug a bit to discourage direct linking to the file.
|
// Muddle up the page slug a bit to discourage direct linking to the file.
|
||||||
$slug = str_replace('/', '|', $tag->parent()->id());
|
$slug = str_replace('/', '|', $tag->parent()->id());
|
||||||
$slug = esc(str_rot13($slug), 'url');
|
$slug = esc(str_rot13($slug), 'url');
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
return $ex->getMessage();
|
||||||
|
}
|
||||||
// Send the link.
|
// Send the link.
|
||||||
return '<a href="/download/' . $slug . '/' . esc($tag->value(), 'url') . '" class="downloadlink">' . $desc . ' (' . $size . ')</a>';
|
return '<a href="/download/' . $slug . '/' . esc($tag->value(), 'url') . '" class="downloadlink">' . $desc . ' (' . $size . ')</a>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,5 @@
|
||||||
<body>
|
<body>
|
||||||
<script src="/assets/js/jquery-3.6.0.min.js"></script>
|
<script src="/assets/js/jquery-3.6.0.min.js"></script>
|
||||||
<script type="text/javascript" src="/assets/slick/slick.min.js"></script>
|
<script type="text/javascript" src="/assets/slick/slick.min.js"></script>
|
||||||
<?php snippet('menu') ?>
|
|
||||||
<div class="container mainpage">
|
<div class="container mainpage">
|
||||||
|
<?php snippet('menu') ?>
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle Navigation">
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle Navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
<?php foreach($site->children()->listed() as $item): ?>
|
<?php foreach($site->children()->listed() as $item): ?>
|
||||||
<?php if ($item->hasListedChildren() && strcasecmp($item->title(), "Home")) { ?>
|
<?php if ($item->hasListedChildren() && strcasecmp($item->slug(), "home")) { ?>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"><?= $item->title() ?></a>
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"><?= $item->title() ?></a>
|
||||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
@ -23,5 +25,36 @@
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||||
|
<?php if ($kirby->user() && !$kirby->session()->get('kpNewUser')) { ?>
|
||||||
|
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<?php
|
||||||
|
if ($kirby->user()->name() && strlen($kirby->user()->name()) > 1) {
|
||||||
|
$userDropDown = esc($kirby->user()->name(), 'html');
|
||||||
|
} else {
|
||||||
|
$userDropDown = esc($kirby->user()->email(), 'html');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"><?= $userDropDown ?></a>
|
||||||
|
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<li><a class="dropdown-item" href="/user">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="/logout">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<li class="nav-item"><a class="nav-link" href="/login">Login</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="/register">Register</a></li>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
|
|
12
kanga.world/site/templates/activated.php
Normal file
12
kanga.world/site/templates/activated.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
if ($kirby->session()->get('kpActivated') !== true) {
|
||||||
|
go('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
$kirby->session()->remove('kpActivated');
|
||||||
|
snippet('header');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?= $page->text()->kirbytext() ?>
|
||||||
|
|
||||||
|
<?php snippet('footer') ?>
|
12
kanga.world/site/templates/newuser.php
Normal file
12
kanga.world/site/templates/newuser.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
if ($kirby->session()->get('kpNewUser') !== true) {
|
||||||
|
go('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
$kirby->session()->remove('kpNewUser');
|
||||||
|
snippet('header');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?= $page->text()->kirbytext() ?>
|
||||||
|
|
||||||
|
<?php snippet('footer') ?>
|
Loading…
Add table
Reference in a new issue