Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh: Add Cookie Policy page #34

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions controllers/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,35 @@ public function actionUpdate()
]);
}

/**
* @return string
* @throws HttpException
*/
public function actionCookies()
{
if (Yii::$app->user->isGuest) {
return $this->goHome();
}

$page = Page::getPage(Page::PAGE_KEY_COOKIE_POLICY);
if ($page === null || !$this->module->isPageEnabled(Page::PAGE_KEY_COOKIE_POLICY)) {
throw new HttpException('404', 'Could not find page!');
}

$this->layout = '@user/views/layouts/main';
$this->subLayout = '@legal/views/page/layout_login';

if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->goHome();
}

return $this->render('update', [
'page' => $page,
'model' => $model,
'module' => $this->module
]);
}

/**
* @return bool can Manage pages
*/
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.3.1 (TBA)
-----------------------
- Enh: Cookie Policy Implementation

1.3.0 (July 19, 2022)
---------------------
- Fix #49: After accepting page, user should be redirected to the `Yii::$app->user->getReturnUrl()` URL.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Adds several editable legal options to your installation like an imprint and a p
### Features

- Supports multi-language (legal texts can be assigned for every language supported by HumHub)
- Adds shortlinks to your legal pages into the footer navigation (Imprint, Privacy Policy, Terms and Conditions)
- Adds shortlinks to your legal pages into the footer navigation (Imprint, Privacy Policy, Terms and Conditions, Cookie Policy)
- Adds shortlinks to the registration page and the registrations emails
- Adds confirmation checkboxes to the registration page e.g. agreeing to the Terms and Conditions
- Adds an age verification to the registration page
Expand Down
4 changes: 3 additions & 1 deletion models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Page extends ActiveRecord
const PAGE_KEY_TERMS = 'terms';
const PAGE_KEY_PRIVACY_PROTECTION = 'privacy';
const PAGE_KEY_COOKIE_NOTICE = 'cookies';
const PAGE_KEY_COOKIE_POLICY = 'cookies_policy';
const PAGE_KEY_LEGAL_UPDATE = 'update';

/**
Expand Down Expand Up @@ -103,6 +104,7 @@ public static function getPages()
static::PAGE_KEY_TERMS => Yii::t('LegalModule.base', 'Terms and Conditions'),
static::PAGE_KEY_PRIVACY_PROTECTION => Yii::t('LegalModule.base', 'Privacy Policy'),
static::PAGE_KEY_COOKIE_NOTICE => Yii::t('LegalModule.base', 'Cookie notification'),
static::PAGE_KEY_COOKIE_POLICY => Yii::t('LegalModule.base', 'Cookie Policy'),
static::PAGE_KEY_LEGAL_UPDATE => Yii::t('LegalModule.base', 'Legal Update'),
];
}
Expand All @@ -112,7 +114,7 @@ public static function getPages()
*/
public static function getFooterMenuPages()
{
return [static::PAGE_KEY_TERMS, static::PAGE_KEY_PRIVACY_PROTECTION, static::PAGE_KEY_IMPRINT];
return [static::PAGE_KEY_TERMS, static::PAGE_KEY_PRIVACY_PROTECTION, static::PAGE_KEY_IMPRINT, static::PAGE_KEY_COOKIE_POLICY];
}

public static function getDefaultPageTitle($pageKey)
Expand Down