Skip to content

Commit

Permalink
chore: simplify login template
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Oct 12, 2023
1 parent 249d44e commit 6bcacb2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 35 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-2023 Johann Schopplich
Copyright (c) 2021-PRESENT Johann Schopplich

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@ Protect pages that you want to hide from unwanted views with a password.

## Installation

### Download

Download and copy this repository to `/site/plugins/kirby-locked-pages`.

### Git Submodule

```
git submodule add https://github.com/johannschopplich/kirby-locked-pages.git site/plugins/kirby-locked-pages
```

### Composer

```
composer require johannschopplich/kirby-locked-pages
```

### Download

Download and copy this repository to `/site/plugins/kirby-locked-pages`.

## Usage

When a locked page is visited, Kirby will redirect to a login form ([virtual page](https://getkirby.com/docs/guide/virtual-pages)), where a password may be entered. Once the user enters the correct password, he will be redirected back to the page URL which was locked before.
Expand Down Expand Up @@ -94,7 +88,7 @@ return [
'slug' => 'geschuetzt',
'title' => 'Gesch眉tzte Seite',
'error' => [
'csrf' => 'Der CSRF-Token ist nicht korrket',
'csrf' => 'Der CSRF-Token ist nicht korrekt',
'password' => 'Das Passwort ist nicht korrekt'
]
]
Expand All @@ -107,4 +101,4 @@ return [

## License

[MIT](./LICENSE) License 漏 2021-2023 [Johann Schopplich](https://github.com/johannschopplich)
[MIT](./LICENSE) License 漏 2021-PRESENT [Johann Schopplich](https://github.com/johannschopplich)
35 changes: 13 additions & 22 deletions templates/locked-pages-login.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<?php snippet('header') ?>
<form method="post">
<section>
<label for="password">Password</label>
<input type="password" id="password" name="password" value="<?= esc(get('password', '')) ?>">

<div class="container">
<form method="post">
<div class="field">
<label class="label">Passwort</label>
<div class="control">
<input class="input" type="password" name="password" value="<?= esc(get('password', '')) ?>">
</div>
<?php if ($error): ?>
<p class="help is-danger"><?= $error ?></p>
<?php endif ?>
</div>
<?php if ($error): ?>
<p><?= $error ?></p>
<?php endif ?>
</section>

<input type="hidden" name="csrf" value="<?= csrf() ?>">
<input type="hidden" name="csrf" value="<?= csrf() ?>">

<div class="field">
<div class="control">
<button class="button is-primary">Seite 枚ffnen</button>
</div>
</div>
</form>
</div>

<?php snippet('footer') ?>
<section>
<button type="submit">Open Page</button>
</section>
</form>

0 comments on commit 6bcacb2

Please sign in to comment.