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 public $_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)
37 if (!$userid) $userid = $this->_userid;
38 $WikiPageName = new WikiPageName($userid);
39 return $WikiPageName->isValid() and ($userid === $WikiPageName->name);
44 return $this->_HomePagehandle and $this->_HomePagehandle->exists();
47 /** A PersonalPagePassUser requires PASSWORD_LENGTH_MINIMUM.
48 * BUT if the user already has a homepage with an empty password
49 * stored, allow login but warn him to change it.
51 function checkPass($submitted_password)
53 if ($this->userExists()) {
54 $stored_password = $this->_prefs->get('passwd');
55 if (empty($stored_password)) {
56 if (PASSWORD_LENGTH_MINIMUM > 0) {
57 trigger_error(sprintf(
58 _("PersonalPage login method:") . "\n" .
59 _("You stored an empty password in your ā%sā page.") . "\n" .
60 _("Your access permissions are only for a BogoUser.") . "\n" .
61 _("Please set a password in UserPreferences."),
62 $this->_userid), E_USER_WARNING);
63 $this->_level = WIKIAUTH_BOGO;
65 if (!empty($submitted_password))
66 trigger_error(sprintf(
67 _("PersonalPage login method:") . "\n" .
68 _("You stored an empty password in your ā%sā page.") . "\n" .
69 _("Given password ignored.") . "\n" .
70 _("Please set a password in UserPreferences."),
71 $this->_userid), E_USER_WARNING);
72 $this->_level = WIKIAUTH_USER;
76 if ($this->_checkPass($submitted_password, $stored_password))
77 return ($this->_level = WIKIAUTH_USER);
78 return _PassUser::checkPass($submitted_password);
89 // c-hanging-comment-ender-p: nil
90 // indent-tabs-mode: nil