Author Topic: Courier-Imap disableImap not handled by RoundCube 0.7.2  (Read 2749 times)

Offline js67

  • Newbie
  • *
  • Posts: 2
Courier-Imap disableImap not handled by RoundCube 0.7.2
« on: May 19, 2012, 06:00:00 AM »
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
« Last Edit: May 19, 2012, 06:01:40 AM by js67 »

Offline js67

  • Newbie
  • *
  • Posts: 2
Re: Courier-Imap disableImap not handled by RoundCube 0.7.2
« Reply #1 on: May 20, 2012, 02:28:12 AM »
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

Code: [Select]
// create new session ID, don't destroy the current session

Just above this line, copy the below code

Code: [Select]
  //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

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

Just before these lines, add

Code: [Select]
}

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
Code: [Select]
$messages = array();

Just under that line, add the following line :

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

For english localizations, you can set

Code: [Select]
$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
« Last Edit: May 20, 2012, 02:33:50 AM by js67 »