RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Release Support > Release Discussion

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 07-11-2007, 05:27 PM
Registered User
 
Join Date: Jun 2007
Posts: 3
Downloads: 0
Uploads: 0
Send a message via MSN to johncarlson21
Default login for joomla

I know that there is a joomla component for roundcube already but as of now it doesn't allow you to login to joomla with a username and then set the session for roundcube.. does anyone know how this could be accomplished..?

basically could a function be written to include into the joomla login so that when the user logs in it registers the user session variables for rc and logs them in..?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-01-2007, 06:17 AM
Registered User
 
Join Date: Jul 2007
Posts: 11
Downloads: 0
Uploads: 0
Default Re: login for joomla

check this out:


http://extensions.joomla.org/compone...428/Itemid,35/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-01-2007, 07:13 PM
Registered User
 
Join Date: Aug 2007
Posts: 1
Downloads: 0
Uploads: 0
Default Re: login for joomla

no no no no no no no

sheesh, it often seems as though as soon as anyone types joomla and roundcube in the same post the first reflex is to post that link... Because its obviously not something we might have considered trying. If you read the content of the first post, you would read that the person is saying... "I have used the component (There has been only one release of it, and a patch) and it is a good component that works well out of the box, but can you help me with this issue?" All the component actually does is streamline roundcube into a joomla sites php.

The auth-schemes however remain separate. For those of us who actually use both great softwares I can tell you this has been a source of great frustration. The developers of this component mean well, however they point out, rightly, that joomla stores its passwords as md5. Therefore, roundcube cannot use those passwords and so has to maintain its auth-process seperately. So the real question is... is there a way to get roundcube to play nice with joomla anyways and use the same username and password, applying them to known defaults for domains, ports etc? Then, to further have it dynamically follow joomlas keepalive rules for login timing?

Thanks,

tim.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-06-2007, 01:49 PM
bpat1434's Avatar
Administrator
 
Join Date: Jun 2006
Location: Maryland, USA
Posts: 599
Downloads: 17
Uploads: 0
Send a message via ICQ to bpat1434 Send a message via AIM to bpat1434 Send a message via MSN to bpat1434 Send a message via Yahoo to bpat1434 Send a message via Skype™ to bpat1434
Default Re: login for joomla

I don't use Joomla, so I can't say this will work, but wouldn't including the login functions from Joomla on RC login work? I mean, let Joomla do the Joomla thing (without the redirect) and let Roundcube do its thing.

Otherwise, you could write a wrapper to log you. You'd have to write your own mirrored functions to connect to the Joomla DB, query the table, and do the login process.
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 09-23-2007, 08:38 PM
Registered User
 
Join Date: Sep 2007
Location: Santa Fe, NM USA
Posts: 16
Downloads: 0
Uploads: 0
Default Re: login for joomla

No, this will not work as Joomla keeps passwords with MD5 encryption, which is one way. RC requires the original cleartext password for use in logging into the imap server.

What I have done is to grab the users password when they log in to Joomla and encrypt it with the encryption routine used in RC. I store this as a second encrypted password in the joomla user table. Then in wrapper.php I grab the username and the encrypted password, place them in some $_SESSION variables which are passed over to RC. The first thing I do in RC, before anything else, is to grab the $_SESSION variables for use by RC. I replaced the "show login screen" with an automatic login into RC. Usinf the decrypt function in RC, I pass the decrypted password into the imap login function. So, when the user clicks on a WebMail menu item I have setup in Joomla, the next thing they see is there inbox in RC. I have also included the password patch listed in these forums so the user can modify their imap password using the CPanel 11 functions.

All of this works great in IE7, however in both FireFox and Safari the $_SESSION variables are not making it into RC. I am looking into why this is happening.

David
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 10-08-2007, 05:04 AM
Registered User
 
Join Date: Sep 2007
Location: Santa Fe, NM USA
Posts: 16
Downloads: 0
Uploads: 0
Default Re: login for joomla

As mentioned earlier in this thread, the Joomla/RoundCube component is not really an integration of Joomla with RoundCube. The approach I have taken is to use the wrapper functionality of Joomla to integrae RoundCube. Then. in the wrapper.php routine, I append the userID to the RC url. When RoundCube starts, I grab the userID and use it to log the user into the associated IMAP server. This requires keeping an encrypted password that can be decrypted for use in logging into the IMAP server. I use the RoundCube encrypt and decrypt functions for this. This approach requires a new attribute (column) be added to the Joomla user table as described in the following code. Also, you must add the users email account to IMAP using your isp's interface, such as CPanel.

Code:
#
# Support integration with Joomla
#
# You will need to integrate RC into Joomla using the wrapper content functionality.
# The following mods will add an attribute (column) to the Joomla User table to hold the RC password.
# This is required since Joomla encrypts using a one-way encryption and RC needs to have a decrypted
# password to pass to the IMAP login if we are doing automatic logins using the Joomla userID. The first
# time a user logs in to their IMAP account, the password is encrypted and stored in the Joomla user table.
# On subsequent logins, the encrypted IMAP password is read from the Joomla User table, decrypted and
# used to login to the IMAP server. If the userid/password pair do not match in the IMAP server, a RC login
# page will be shown.
#
# -------------------------------------------------------------------------------------------------------------
#
# In file index.php
# Insert after Line 92
$josuid = $_GET['uid']; //Set in Joomla wrapper.php

# Insert after Line 150

	if(isset($_POST['_pass'])){
		$pass = get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1');
		if($pass != ''){
			$lfaencrypt = encrypt_passwd($pass);
			$query = "UPDATE jos_users SET rcpassword = " . $DB->Quote($lfaencrypt) . " WHERE id = " . (int) $_SESSION['JOSUID'];
			$DB->query($query);
		}
	}

# Replace lines that read: $OUTPUT->task = 'login';
#              $OUTPUT->send('login'); (about Line 233,234 old - 239,240 new)
# with:

  $result = $DB->query("SELECT username,rcpassword FROM jos_users WHERE id=?",$josuid);
  $userid = '';
  $dpassword = '';
  if($DB->num_rows()==1){
		$row = $DB->fetch_array( $result );
	  $username = $row[0];
	  $epassword = $row[1];
	  $dpassword = decrypt_passwd($epassword);
  }
  //If $DB->num_rows() != 1 then normal login screen will be displayed.
  $_SESSION['JOSUID'] = $josuid;

 $host = rcmail_autoselect_host();
 // check if client supports cookies
 if (empty($_COOKIE))
 {
  $OUTPUT->show_message("cookiesdisabled", 'warning');
 }
 else if (rcmail_login($username, $dpassword, $host))
 {
  // create new session ID
  unset($_SESSION['temp']);
  sess_regenerate_id();

  // send auth cookie if necessary
  rcmail_authenticate_session();

  // send redirect
  header("Location: $COMM_PATH");

# -------------------------------------------------------------------------------------------------------------
#
# In file joomla/components/com_wrapper/wrapper.php
# Insert after Line 17
session_start();

# Replace line that reads: global $database, $Itemid, $mainframe (about line 25)
# with

	global $database, $Itemid, $mainframe, $my;
# Insert after line that reads: $url = $params->def( 'url', '' ); the following (about line 49)
	if(strstr($url, 'roundcube'))
		$url .= '?uid=' . $my->id;

# -------------------------------------------------------------------------------------------------------------
#
# Database Additions for Joomla integration. Run in the joomla database. Change jos_users to whatever your joomla users table is called
#
# Run in PhpMyAdmin:
#
 ALTER TABLE `jos_users` ADD `rcpassword` VARCHAR(100);
David
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 10-24-2007, 09:21 AM
Registered User
 
Join Date: Oct 2007
Posts: 1
Downloads: 0
Uploads: 0
Default Re: login for joomla

David,

Thanks for the trick.

I gave it a try. Twice actually, just in case I had done anything wrong.


I keep getting the following in the wrapper:

Parse error: syntax error, unexpected T_ELSE in /home/.nipto/palladian/otelho.com/roundcube/index.php on line 190

My roundcube/index.php file is attached.

Would it be possible to post the modified files along with the joomla and roundcube version numbers ?

Attached Files
File Type: php index.php (327 Bytes, 18 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 06-20-2008, 05:58 AM
Registered User
 
Join Date: Jun 2008
Posts: 1
Downloads: 0
Uploads: 0
Default $db ?

Hi,

I trying your trick to connect Joomla with Roundcube with only one login

But it doesn't seems to work.
I think The problem I have is link with the DB.
I m not a PHP expert, but still, have to try :-)

You have a line who update the Joomla database with rcpassword.
Code:
 $query = "UPDATE jos_users SET rcpassword = " . $DB->Quote($lfaencrypt) . " WHERE id = " . (int) $_SESSION['JOSUID'];
But how to you connect to the Joomla database?

Is in your case, joomla and roundcube connect in the same sql server ? with the same User ?

You could please, give some more details.
Thanks :-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 11:49 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community