RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Third Party Contributions > Plug-Ins

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 11-04-2006, 02:15 PM
Registered User
 
Join Date: Oct 2006
Posts: 2
Downloads: 0
Uploads: 0
Default Change password postfix+courier+mysql

It's a nice way to change password /http://postfix.pentachron.net/.

If you want, you can patch roundcube a bit so that your users can change their password in their user preferences. To do so edit the following two files:

First, open 'roundcube/program/steps/settings/func.inc' and search for 'function rcmail_user_prefs_form', then scroll down to the end of this function and add the following code before ' $out .= "\n</table>$form_end";'

// CCC addition
// show password form
$field_id = 'rcmfd_password';
$input_password = new textfield(array('name' => '_password', 'id' => $field_id, 'size' => 20));

$out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s (empty = unchanged)</td></tr>\n",
$field_id,
rep_specialchars_output(rcube_label('password')),
$input_password->show($CONFIG['password']));
// end CCC addition

Then open 'roundcube/program/steps/settings/save_prefs.inc' and insert the following after the line "$a_user_prefs['prefer_html'] = isset($_POST['_prefer_html']) ? TRUE : FALSE;":

// CCC addition
if ($_POST['_password'] != "")
{
mysql_query("UPDATE ccc.emails SET password = '".$_POST['_password']."' WHERE concat(account, '@', domain) = '".$_SESSION['username']."'")
or die(mysql_error());
$_SESSION['password'] = encrypt_passwd($_POST['_password']);
}
// end of CCC addition

Notice: change ccc.emails to yourdatabase.emails if needed!

Notice: the roundcubemail mysql user needs update permissions for the email table!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 01-10-2007, 02:43 PM
Registered User
 
Join Date: Jan 2007
Posts: 2
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

I appreciate the post....this is exactly what I'm looking for.....Pardon me, but I'm a total neub and need to ask a clarifying (probably dumb) question:

you say:
Quote:
Notice: change ccc.emails to yourdatabase.emails if needed!
Notice: the roundcubemail mysql user needs update permissions for the email table!
I changed my code in the two files as instructed, and the new PW change field does show in Preferences, but when I attempt to change the password, the app says that I dont have update permissions to the email table. When I look at my DB for roundcubemail in phpmyadmin, i do not see an emails table. Am I missing something? Is this outside of the roundcube DB?

If you can clarify, I'd really appreciate it.

Thanks in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 01-25-2007, 06:43 PM
Registered User
 
Join Date: Oct 2006
Posts: 5
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

It doesn't work in an existing roundcube system, right? What do I need that it works? Can you make a detailled tutorial on that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-24-2007, 03:19 PM
Registered User
 
Join Date: Aug 2007
Posts: 43
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

Yes, I am very interested in this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 09-10-2007, 04:51 PM
Registered User
 
Join Date: May 2007
Posts: 17
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

I wrote a pacth to do this a few months ago : http://blog.julienwadin.be/index.php...dans-roundcube
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 11-06-2007, 01:55 PM
Registered User
 
Join Date: Nov 2007
Posts: 6
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

Quote:
Originally Posted by Julien
I wrote a pacth to do this a few months ago : http://blog.julienwadin.be/index.php...dans-roundcube
Very Nice work, I'll try it with the RC2 this evening.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 11-06-2007, 04:39 PM
Registered User
 
Join Date: Nov 2007
Posts: 6
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

Quote:
Originally Posted by Julien
I wrote a pacth to do this a few months ago : http://blog.julienwadin.be/index.php...dans-roundcube
There is a bug in your mod. The link to the passwd page doesn't work. Exactly the same problem that's explain in your blog's comments
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 11-07-2007, 04:40 PM
Registered User
 
Join Date: Sep 2007
Posts: 5
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

Can I use this patch with Plesk from SWSoft?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 11-15-2007, 07:15 PM
Registered User
 
Join Date: May 2007
Posts: 17
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

Quote:
Originally Posted by Le Veilleur
Quote:
Originally Posted by Julien
I wrote a pacth to do this a few months ago : http://blog.julienwadin.be/index.php...dans-roundcube
There is a bug in your mod. The link to the passwd page doesn't work. Exactly the same problem that's explain in your blog's comments
My patch works with RC1. I've not yet tested it with RC2. It will be done quickly. Stay in touch.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 11-27-2007, 08:43 AM
Registered User
 
Join Date: Nov 2007
Posts: 10
Downloads: 0
Uploads: 0
Default Re: Change password postfix+courier+mysql

Hello there, I just wanted to tell you that I slightly modified your code to make it work for RC2. Works smoothly

Aproximately near line 29 in file "program\steps\settings\save_prefs.inc", there is a block where an array is declared. It starts with "$a_user_prefs = array(". Just add the following line under the "'prefer_html' => isset($_POST['_prefer_html']) ? TRUE : FALSE," line

// Password MOD
'password' => isset($_POST['_password']) ? TRUE : FALSE,
// End Password MOD

Now just AFTER the "foreach ((array)$CONFIG['dont_override'] as $p) ..." near line 39, add the block which handles password saving to DB

// Password MOD
if (isset($_POST['_password']))
{
$tmpEncPass = YourEncryptionFunctionHERE($_POST['_password'], "");


mysql_query("UPDATE CCC.TableWithPasswordHERE SET password = '".$tmpEncPass."' WHERE username = '".$_SESSION['username']."'")
or die(mysql_error());

$_SESSION['password'] = encrypt_passwd($_POST['_password']);
}
// End Password MOD

Now in "program\steps\settings\func.inc", around line 200, there is some code like "$out .= "\n</table>$form_end";". Just BEFORE this line, add the following block:

// Password MOD
$field_id = 'rcmfd_password';
$input_password = new textfield(array('name' => '_password', 'id' => $field_id, 'size' => 20));

$out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s (empty = unchanged)</td></tr>\n",
$field_id,
rep_specialchars_output(rcube_label('password')),
$input_password->show($CONFIG['password']));
// End Password MOD

It should work One problem I'm experiencing is that the field is not empty when Preferences menu is opened, it has a "1" in it.
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 04:42 AM.


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