til-schneider / slim-wiki

A slim wiki based on PHP and markdown
MIT License
13 stars 7 forks source link

Add private mode: require login for reading #19

Open DivineDominion opened 2 years ago

DivineDominion commented 2 years ago

For an internal wiki, we wanted to not render any page contents unless the visitor is logged-in.

So I extracted the state management logic, refactored things a bit, and introduced a new $mode = 'private'; that renders a static placeholder text.

Features

English/German i18n

Screen Shot 2022-05-02 at 10 23 55 Screen Shot 2022-05-02 at 10 24 01

Does not expose if the URL exists

With the standard set of files from this repo, /notfound shows the same placeholder. So no spying on paths!

Screen Shot 2022-05-02 at 11 27 05

DivineDominion commented 2 years ago

@til-schneider What do you think about the suggestions? We've been trying this internally and it worked quite well so far