4 * Copyright (C) 2004 ReiniUrban
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * This class is only to simplify the auth method dispatcher.
25 * It inherits almost all all methods from _PassUser.
27 class _PersonalPagePassUser
30 var $_authmethod = 'PersonalPage';
32 /* Very loose checking, since we properly quote the PageName.
33 Just trim spaces, ... See lib/stdlib.php
35 function isValidName ($userid = false) {
36 if (!$userid) $userid = $this->_userid;
37 $WikiPageName = new WikiPageName($userid);
38 return $WikiPageName->isValid() and ($userid === $WikiPageName->name);
41 function userExists() {
42 return $this->_HomePagehandle and $this->_HomePagehandle->exists();
45 /** A PersonalPagePassUser requires PASSWORD_LENGTH_MINIMUM.
46 * BUT if the user already has a homepage with an empty password
47 * stored, allow login but warn him to change it.
49 function checkPass($submitted_password) {
50 if ($this->userExists()) {
51 $stored_password = $this->_prefs->get('passwd');
52 if (empty($stored_password)) {
53 if (PASSWORD_LENGTH_MINIMUM > 0) {
54 trigger_error(sprintf(
55 _("PersonalPage login method:")."\n".
56 _("You stored an empty password in your '%s' page.")."\n".
57 _("Your access permissions are only for a BogoUser.")."\n".
58 _("Please set a password in UserPreferences."),
59 $this->_userid), E_USER_WARNING);
60 $this->_level = WIKIAUTH_BOGO;
62 if (!empty($submitted_password))
63 trigger_error(sprintf(
64 _("PersonalPage login method:")."\n".
65 _("You stored an empty password in your '%s' page.")."\n".
66 _("Given password ignored.")."\n".
67 _("Please set a password in UserPreferences."),
68 $this->_userid), E_USER_WARNING);
69 $this->_level = WIKIAUTH_USER;
73 if ($this->_checkPass($submitted_password, $stored_password))
74 return ($this->_level = WIKIAUTH_USER);
75 return _PassUser::checkPass($submitted_password);
86 // c-hanging-comment-ender-p: nil
87 // indent-tabs-mode: nil