]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiUser/BogoLogin.php
looser isValidName method
[SourceForge/phpwiki.git] / lib / WikiUser / BogoLogin.php
1 <?php //-*-php-*-
2 rcs_id('$Id: BogoLogin.php,v 1.5 2005-02-14 12:28:27 rurban Exp $');
3 /* Copyright (C) 2004 ReiniUrban
4  * This file is part of PhpWiki. Terms and Conditions see LICENSE. (GPL2)
5  */
6
7 /** Without stored password. A _BogoLoginPassUser with password 
8  *  is automatically upgraded to a PersonalPagePassUser.
9  */
10 class _BogoLoginPassUser
11 extends _PassUser
12 {
13     var $_authmethod = 'BogoLogin';
14     function userExists() {
15         if (isWikiWord($this->_userid)) {
16             $this->_level = WIKIAUTH_BOGO;
17             return true;
18         } else {
19             $this->_level = WIKIAUTH_ANON;
20             return false;
21         }
22     }
23
24     /** A BogoLoginUser requires no password at all
25      *  But if there's one stored, we override it with the PersonalPagePassUser instead
26      */
27     function checkPass($submitted_password) {
28         if ($this->_prefs->get('passwd')) {
29             if (isset($this->_prefs->_method) and $this->_prefs->_method == 'HomePage') {
30                 $user = new _PersonalPagePassUser($this->_userid, $this->_prefs);
31                 if ($user->checkPass($submitted_password)) {
32                     if (!check_php_version(5))
33                         eval("\$this = \$user;");
34                     // /*PHP5 patch*/$this = $user;
35                     $user = UpgradeUser($this, $user);
36                     $this->_level = WIKIAUTH_USER;
37                     return $this->_level;
38                 } else {
39                     $this->_level = WIKIAUTH_ANON;
40                     return $this->_level;
41                 }
42             } else {
43                 $stored_password = $this->_prefs->get('passwd');
44                 if ($this->_checkPass($submitted_password, $stored_password)) {
45                     $this->_level = WIKIAUTH_USER;
46                     return $this->_level;
47                 } elseif (USER_AUTH_POLICY === 'strict') {
48                     $this->_level = WIKIAUTH_FORBIDDEN;
49                     return $this->_level;
50                 } else {
51                     return $this->_tryNextPass($submitted_password);
52                 }
53             }
54         }
55         if (isWikiWord($this->_userid)) {
56             $this->_level = WIKIAUTH_BOGO;
57         } else {
58             $this->_level = WIKIAUTH_ANON;
59         }
60         return $this->_level;
61     }
62 }
63
64 // $Log: not supported by cvs2svn $
65 // Revision 1.4  2004/12/26 17:11:15  rurban
66 // just copyright
67 //
68 // Revision 1.3  2004/11/06 03:07:03  rurban
69 // make use of dumped static config state in config/config.php (if writable)
70 //
71 // Revision 1.2  2004/11/05 20:53:36  rurban
72 // login cleanup: better debug msg on failing login,
73 // checked password less immediate login (bogo or anon),
74 // checked olduser pref session error,
75 // better PersonalPage without password warning on minimal password length=0
76 //   (which is default now)
77 //
78 // Revision 1.1  2004/11/01 10:43:58  rurban
79 // seperate PassUser methods into seperate dir (memory usage)
80 // fix WikiUser (old) overlarge data session
81 // remove wikidb arg from various page class methods, use global ->_dbi instead
82 // ...
83 //
84
85 // Local Variables:
86 // mode: php
87 // tab-width: 8
88 // c-basic-offset: 4
89 // c-hanging-comment-ender-p: nil
90 // indent-tabs-mode: nil
91 // End:
92 ?>