]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/PersonalPage.php
login cleanup: better debug msg on failing login,
[SourceForge/phpwiki.git] / lib / WikiUser / PersonalPage.php
1 <?php //-*-php-*-
2 rcs_id('$Id: PersonalPage.php,v 1.2 2004-11-05 20:53:36 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                 if (PASSWORD_LENGTH_MINIMUM > 0) {
28                   trigger_error(sprintf(
29                     _("PersonalPage login method:\n").
30                     _("You stored an empty password in your '%s' page.\n").
31                     _("Your access permissions are only for a BogoUser.\n").
32                     _("Please set a password in UserPreferences."),
33                                         $this->_userid), E_USER_WARNING);
34                   $this->_level = WIKIAUTH_BOGO;
35                 } else {
36                   trigger_error(sprintf(
37                     _("PersonalPage login method:\n").
38                     _("You stored an empty password in your '%s' page.\n").
39                     _("Given password ignored.\n").
40                     _("Please set a password in UserPreferences."),
41                                         $this->_userid), E_USER_WARNING);
42                   $this->_level = WIKIAUTH_USER;
43                 }
44                 return $this->_level;
45             }
46             if ($this->_checkPass($submitted_password, $stored_password))
47                 return ($this->_level = WIKIAUTH_USER);
48             return _PassUser::checkPass($submitted_password);
49         }
50         return WIKIAUTH_ANON;
51     }
52 }
53
54 // $Log: not supported by cvs2svn $
55 // Revision 1.1  2004/11/01 10:43:58  rurban
56 // seperate PassUser methods into seperate dir (memory usage)
57 // fix WikiUser (old) overlarge data session
58 // remove wikidb arg from various page class methods, use global ->_dbi instead
59 // ...
60 //
61
62 // Local Variables:
63 // mode: php
64 // tab-width: 8
65 // c-basic-offset: 4
66 // c-hanging-comment-ender-p: nil
67 // indent-tabs-mode: nil
68 // End:
69 ?>