Roundcube Community Forum

 

Courier-Imap disableImap not handled by RoundCube 0.7.2

Started by js67, May 19, 2012, 06:00:00 AM

Previous topic - Next topic

js67

Hello,

I'm using RoundCube for years now and I'm encountering an issue.
I've disabled a courier-imap account by setting  the disableImap option to true and restarted the courier auth service.
However, RoundCube still allows this disabled imap account to login.
Once authentificated, RoundCube interface is shown and a message appears saying that the account is disabled.
So the inbox is empty as well as the folder list.
However, this user is still able to send mails via RoundCube.
Is it possible to update RoundCube login function to handle disabled accounts and prevent login for those ?

Regards

Julien

js67

Hi,

I was able to update RoundCube to handle disabled IMAP account.
For this I've updated index.php and messages.inc for my localization.

I'm posting this here as it may help other users of Roundcube.

Step 1: updating index.php

open index.php and search the line


// create new session ID, don't destroy the current session


Just above this line, copy the below code


  //Handling of disabled IMAP accounts
  $error_code = is_object($IMAP) ? $IMAP->get_error_code() : -1;
  if ($error_code == -5) {
    $OUTPUT->show_message('disabledaccount', 'warning');
    $RCMAIL->plugins->exec_hook('login_failed', array(
      'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user']));
    $RCMAIL->kill_session();   
  }
  else
  {


Search for the below code


  else {
    $error_code = is_object($IMAP) ? $IMAP->get_error_code() : -1;


Just before these lines, add


}


Step 2: updating messages.inc

Open your localization messages.inc file (ex: for french, it's /program/localization/fr_FR/messages.inc)

Find the line

$messages = array();


Just under that line, add the following line :


$messages['disabledaccount'] = 'Erreur d\'authentification, compte désactivé';


For english localizations, you can set


$messages['disabledaccount'] = 'Login failed, disabled account';


in /program/localization/en_US/messages.inc or in /program/localization/en_GB/messages.inc

All done :)

See attached the updated index.php for roundCube 0.72