Summary: Login form with "Remember me/Stay signed in" option
This recipe allows users to stay logged in for several days.
1. Place persistentlogin.phpΔ to your cookbook directory (alt.download: persistentlogin.php).
2. Place the following code near the top of your (farm)config.php:
The above code should be placed after the
<?php line, and after any line containing
The recipe should be the first included in (farm)config.php if possible, notably before AuthUser.
3. Edit your wiki page
[[Site.AuthForm]] and place the following line before the final
(:input checkbox persistentlogin 1:) $[Remember me]
When you log in, check the box "Remember me".
Here are the settings you can customize in (farm)config.php, before including the script:
# Where to save session files, preferably inaccessible via HTTP
$PersistentSessionDir = "directory"; # default "
# How many days of inactivity "expire" logged in users
$PersistentSessionDays = 10 ; # default 3
On some Debian-derived systems, if old session files stay in your wiki.d/.sessions directory, add also this line:
If your wiki has more than one language, you can translate the "Remember me" string. Set in your XLPage the following (eg. for French):
'Remember me' => "Rester connecté",
- The users are kept permanently logged in, but if they do not visit the wiki for 3 days or more, they are logged out.
- Persistent logins are less secure. Never use the "Remember me" checkbox on computers which may be used by other people.
- Your browser/proxy should allow persistent cookies (some do not).
- 20091122 - Fix for PHP 5.3 installations.
- 20090711 - First public release.
- PITS:01083 Add persistent authorization option
- FixShortSessions How to fix short sessions so you aren't prompted frequently for a password
- UserAuth2 A user-based permission granting and authentication module
- Recipe written and maintained by Petko.
User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.