passman/lib/Controller/PageController.php
2023-06-14 14:12:49 +02:00

58 lines
1.5 KiB
PHP

<?php
/**
* Nextcloud - passman
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Sander Brand <brantje@gmail.com>
* @copyright Sander Brand 2016
*/
namespace OCA\Passman\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
class PageController extends Controller {
public function __construct(string $AppName, IRequest $request, private string $userId) {
parent::__construct($AppName, $request);
}
/**
* CAUTION: the @Stuff turns off security checks; for this page no admin is
* required and no CSRF check. If you don't know what CSRF is, read
* it up in the docs or you might create a security hole. This is
* basically the only required method to add this exemption, don't
* add it to any other method if you don't exactly know what it does
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index() {
$params = ['user' => $this->userId];
return new TemplateResponse('passman', 'main', $params); // templates/main.php
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function bookmarklet($url='', $title='') {
$params = array('url' => $url, 'title' => $title);
return new TemplateResponse('passman', 'bookmarklet', $params);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
*/
public function publicSharePage() {
return new TemplateResponse('passman', 'public_share');
}
}