3 /* Copyright (C) 2004 $ThePhpWikiProgrammingTeam
4 * This file is part of PhpWiki. Terms and Conditions see LICENSE. (GPL2)
10 * Define the var IMAP_AUTH_HOST in config/config.ini (with port probably)
12 * Preferences are handled in _PassUser
15 function checkPass($submitted_password) {
16 if (!$this->isValidName()) {
17 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => failed isValidName", E_USER_WARNING);
18 trigger_error(_("Invalid username."),E_USER_WARNING);
19 return $this->_tryNextPass($submitted_password);
21 if (!$this->_checkPassLength($submitted_password)) {
22 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => failed checkPassLength", E_USER_WARNING);
23 return WIKIAUTH_FORBIDDEN;
25 $userid = $this->_userid;
26 $mbox = @imap_open( "{" . IMAP_AUTH_HOST . "}",
27 $userid, $submitted_password, OP_HALFOPEN );
30 $this->_authmethod = 'IMAP';
31 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => ok", E_USER_WARNING);
32 $this->_level = WIKIAUTH_USER;
35 if ($submitted_password != "") { // if LENGTH 0 is allowed
36 trigger_error(_("Unable to connect to IMAP server "). IMAP_AUTH_HOST,
40 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::checkPass => wrong", E_USER_WARNING);
42 return $this->_tryNextPass($submitted_password);
45 //CHECKME: this will not be okay for the auth policy strict
46 function userExists() {
49 if ($this->checkPass($this->_prefs->get('passwd'))) {
50 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::userExists => true (pass ok)", E_USER_WARNING);
53 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::userExists => false (pass wrong)", E_USER_WARNING);
54 return $this->_tryNextUser();
57 function mayChangePass() {
58 if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this)."::mayChangePass => false", E_USER_WARNING);
67 // c-hanging-comment-ender-p: nil
68 // indent-tabs-mode: nil