3 /* Copyright (C) 2004 ReiniUrban
4 * This file is part of PhpWiki. Terms and Conditions see LICENSE. (GPL2)
8 * This class is only to simplify the auth method dispatcher.
9 * It inherits almost all all methods from _PassUser.
11 class _PersonalPagePassUser
14 var $_authmethod = 'PersonalPage';
16 /* Very loose checking, since we properly quote the PageName.
17 Just trim spaces, ... See lib/stdlib.php
19 function isValidName ($userid = false) {
20 if (!$userid) $userid = $this->_userid;
21 $WikiPageName = new WikiPageName($userid);
22 return $WikiPageName->isValid() and ($userid === $WikiPageName->name);
25 function userExists() {
26 return $this->_HomePagehandle and $this->_HomePagehandle->exists();
29 /** A PersonalPagePassUser requires PASSWORD_LENGTH_MINIMUM.
30 * BUT if the user already has a homepage with an empty password
31 * stored, allow login but warn him to change it.
33 function checkPass($submitted_password) {
34 if ($this->userExists()) {
35 $stored_password = $this->_prefs->get('passwd');
36 if (empty($stored_password)) {
37 if (PASSWORD_LENGTH_MINIMUM > 0) {
38 trigger_error(sprintf(
39 _("PersonalPage login method:")."\n".
40 _("You stored an empty password in your '%s' page.")."\n".
41 _("Your access permissions are only for a BogoUser.")."\n".
42 _("Please set a password in UserPreferences."),
43 $this->_userid), E_USER_WARNING);
44 $this->_level = WIKIAUTH_BOGO;
46 if (!empty($submitted_password))
47 trigger_error(sprintf(
48 _("PersonalPage login method:")."\n".
49 _("You stored an empty password in your '%s' page.")."\n".
50 _("Given password ignored.")."\n".
51 _("Please set a password in UserPreferences."),
52 $this->_userid), E_USER_WARNING);
53 $this->_level = WIKIAUTH_USER;
57 if ($this->_checkPass($submitted_password, $stored_password))
58 return ($this->_level = WIKIAUTH_USER);
59 return _PassUser::checkPass($submitted_password);
66 // $Log: not supported by cvs2svn $
67 // Revision 1.6 2005/06/22 05:36:52 rurban
68 // looser isValidName method
70 // Revision 1.5 2005/02/14 12:28:27 rurban
71 // fix policy strict. Thanks to Mikhail Vladimirov
73 // Revision 1.4 2004/12/26 17:11:17 rurban
76 // Revision 1.3 2004/11/05 22:09:39 rurban
77 // empty passwd PersonalPage case
79 // Revision 1.2 2004/11/05 20:53:36 rurban
80 // login cleanup: better debug msg on failing login,
81 // checked password less immediate login (bogo or anon),
82 // checked olduser pref session error,
83 // better PersonalPage without password warning on minimal password length=0
84 // (which is default now)
86 // Revision 1.1 2004/11/01 10:43:58 rurban
87 // seperate PassUser methods into seperate dir (memory usage)
88 // fix WikiUser (old) overlarge data session
89 // remove wikidb arg from various page class methods, use global ->_dbi instead
97 // c-hanging-comment-ender-p: nil
98 // indent-tabs-mode: nil