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
19 * along with PhpWiki; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) {
32 if (!$this->isValidName()) {
33 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => failed isValidName", E_USER_WARNING);
34 trigger_error(_("Invalid username."),E_USER_WARNING);
35 return $this->_tryNextPass($submitted_password);
37 if (!$this->_checkPassLength($submitted_password)) {
38 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => failed checkPassLength", E_USER_WARNING);
39 return WIKIAUTH_FORBIDDEN;
41 $userid = $this->_userid;
42 $mbox = @imap_open( "{" . IMAP_AUTH_HOST . "}",
43 $userid, $submitted_password, OP_HALFOPEN );
46 $this->_authmethod = 'IMAP';
47 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => ok", E_USER_WARNING);
48 $this->_level = WIKIAUTH_USER;
51 if ($submitted_password != "") { // if LENGTH 0 is allowed
52 trigger_error(_("Unable to connect to IMAP server "). IMAP_AUTH_HOST,
56 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => wrong", E_USER_WARNING);
58 return $this->_tryNextPass($submitted_password);
61 //CHECKME: this will not be okay for the auth policy strict
62 function userExists() {
65 if ($this->checkPass($this->_prefs->get('passwd'))) {
66 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::userExists => true (pass ok)", E_USER_WARNING);
69 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::userExists => false (pass wrong)", E_USER_WARNING);
70 return $this->_tryNextUser();
73 function mayChangePass() {
74 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::mayChangePass => false", E_USER_WARNING);
83 // c-hanging-comment-ender-p: nil
84 // indent-tabs-mode: nil