]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/PersonalPage.php
seperate PassUser methods into seperate dir (memory usage)
[SourceForge/phpwiki.git] / lib / WikiUser / PersonalPage.php
1 <?php //-*-php-*-
2 rcs_id('$Id: PersonalPage.php,v 1.1 2004-11-01 10:43:58 rurban Exp $');
3 /* Copyright (C) 2004 $ThePhpWikiProgrammingTeam
4  */
5
6 /**
7  * This class is only to simplify the auth method dispatcher.
8  * It inherits almost all all methods from _PassUser.
9  */
10 class _PersonalPagePassUser
11 extends _PassUser
12 {
13     var $_authmethod = 'PersonalPage';
14
15     function userExists() {
16         return $this->_HomePagehandle and $this->_HomePagehandle->exists();
17     }
18
19     /** A PersonalPagePassUser requires PASSWORD_LENGTH_MINIMUM.
20      *  BUT if the user already has a homepage with an empty password 
21      *  stored, allow login but warn him to change it.
22      */
23     function checkPass($submitted_password) {
24         if ($this->userExists()) {
25             $stored_password = $this->_prefs->get('passwd');
26             if (empty($stored_password)) {
27                 trigger_error(sprintf(
28                 _("PersonalPage login method:\n").
29                 _("You stored an empty password in your '%s' page.\n").
30                 _("Your access permissions are only for a BogoUser.\n").
31                 _("Please set your password in UserPreferences."),
32                                         $this->_userid), E_USER_WARNING);
33                 $this->_level = WIKIAUTH_BOGO;
34                 return $this->_level;
35             }
36             if ($this->_checkPass($submitted_password, $stored_password))
37                 return ($this->_level = WIKIAUTH_USER);
38             return _PassUser::checkPass($submitted_password);
39         }
40         return WIKIAUTH_ANON;
41     }
42 }
43
44 // $Log: not supported by cvs2svn $
45
46 // Local Variables:
47 // mode: php
48 // tab-width: 8
49 // c-basic-offset: 4
50 // c-hanging-comment-ender-p: nil
51 // indent-tabs-mode: nil
52 // End:
53 ?>