aboutsummaryrefslogtreecommitdiff
path: root/app/class/Controllerpage.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-05-25 19:48:15 +0200
committervincent-peugnet <v.peugnet@free.fr>2020-05-25 19:48:15 +0200
commit19d16efebc3fb5c0b2aede29aa91d31000ffd124 (patch)
tree48e55d1dc335efe5ce306c0a984300de9d4998b4 /app/class/Controllerpage.php
parent55fc826f9827dd86427534c11594c0d9c4f0b8d1 (diff)
downloadwcms-19d16efebc3fb5c0b2aede29aa91d31000ffd124.tar.gz
wcms-19d16efebc3fb5c0b2aede29aa91d31000ffd124.zip
add page specific password protection close #118
Diffstat (limited to 'app/class/Controllerpage.php')
-rw-r--r--app/class/Controllerpage.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php
index e864dd3..2e1c285 100644
--- a/app/class/Controllerpage.php
+++ b/app/class/Controllerpage.php
@@ -131,15 +131,25 @@ class Controllerpage extends Controller
if ($pageexist) {
$canread = $this->user->level() >= $this->page->secure();
+ // Check page password
+ if (!empty($this->page->password())) {
+ if (empty($_POST['pagepassword']) || $_POST['pagepassword'] !== $this->page->password()) {
+ $this->showtemplate('pagepassword', ['pageid' => $this->page->id()]);
+ exit;
+ }
+ }
+
if ($this->page->daterender() < $this->page->datemodif()) {
if (Config::reccursiverender()) {
$this->reccursiverender($this->page);
}
$this->page = $this->renderpage($this->page);
}
+
+
if ($canread) {
$this->page->addaffcount();
- if ($this->user->level() < 2) {
+ if ($this->user->isvisitor()) {
$this->page->addvisitcount();
}
}