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);
70 // c-hanging-comment-ender-p: nil
71 // indent-tabs-mode: nil