4 * Copyright (C) 2004 $ThePhpWikiProgrammingTeam
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * Define the var IMAP_AUTH_HOST in config/config.ini (with port probably)
28 * Preferences are handled in _PassUser
31 function checkPass($submitted_password)
33 if (!$this->isValidName()) {
34 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING);
35 trigger_error(_("Invalid username."), E_USER_WARNING);
36 return $this->_tryNextPass($submitted_password);
38 if (!$this->_checkPassLength($submitted_password)) {
39 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING);
40 return WIKIAUTH_FORBIDDEN;
42 $userid = $this->_userid;
43 $mbox = @imap_open("{" . IMAP_AUTH_HOST . "}",
44 $userid, $submitted_password, OP_HALFOPEN);
47 $this->_authmethod = 'IMAP';
48 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => ok", E_USER_WARNING);
49 $this->_level = WIKIAUTH_USER;
52 if ($submitted_password != "") { // if LENGTH 0 is allowed
53 trigger_error(_("Unable to connect to IMAP server ") . IMAP_AUTH_HOST,
57 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => wrong", E_USER_WARNING);
59 return $this->_tryNextPass($submitted_password);
62 //CHECKME: this will not be okay for the auth policy strict
67 if ($this->checkPass($this->_prefs->get('passwd'))) {
68 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::userExists => true (pass ok)", E_USER_WARNING);
71 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::userExists => false (pass wrong)", E_USER_WARNING);
72 return $this->_tryNextUser();
75 function mayChangePass()
77 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::mayChangePass => false", E_USER_WARNING);
86 // c-hanging-comment-ender-p: nil
87 // indent-tabs-mode: nil