]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/PersonalPage.php
empty passwd PersonalPage case
[SourceForge/phpwiki.git] / lib / WikiUser / PersonalPage.php
1 <?php //-*-php-*-
2 rcs_id('$Id: PersonalPage.php,v 1.3 2004-11-05 22:09:39 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                   if (!empty($submitted_password))
37                     trigger_error(sprintf(
38                       _("PersonalPage login method:\n").
39                       _("You stored an empty password in your '%s' page.\n").
40                       _("Given password ignored.\n").
41                       _("Please set a password in UserPreferences."),
42                                         $this->_userid), E_USER_WARNING);
43                   $this->_level = WIKIAUTH_USER;
44                 }
45                 return $this->_level;
46             }
47             if ($this->_checkPass($submitted_password, $stored_password))
48                 return ($this->_level = WIKIAUTH_USER);
49             return _PassUser::checkPass($submitted_password);
50         }
51         return WIKIAUTH_ANON;
52     }
53 }
54
55 // $Log: not supported by cvs2svn $
56 // Revision 1.2  2004/11/05 20:53:36  rurban
57 // login cleanup: better debug msg on failing login,
58 // checked password less immediate login (bogo or anon),
59 // checked olduser pref session error,
60 // better PersonalPage without password warning on minimal password length=0
61 //   (which is default now)
62 //
63 // Revision 1.1  2004/11/01 10:43:58  rurban
64 // seperate PassUser methods into seperate dir (memory usage)
65 // fix WikiUser (old) overlarge data session
66 // remove wikidb arg from various page class methods, use global ->_dbi instead
67 // ...
68 //
69
70 // Local Variables:
71 // mode: php
72 // tab-width: 8
73 // c-basic-offset: 4
74 // c-hanging-comment-ender-p: nil
75 // indent-tabs-mode: nil
76 // End:
77 ?>