Post Reply  Post Thread 
Pages (3): « First [1] 2 3 Next > Last »
Password changer for Roundcube Webmail
Author Message
Cube
Documentation Team
***
Docu Team

Posts: 660
Group: Docu Team
Joined: Apr 2007
Status: Offline
Reputation: 8
Post: #1
Password changer for Roundcube Webmail

This HowTo describes how to implement a password changer into Roundcube.

How it works
With this mod RC will set the new pasword directly in the ispcp database and call the ispCP-daemon to update the configs.

Requirements
- a working Roundcube (version 0.1.1) which is installed in ispCP's tools-directory (Please do not ask about how to install Roundcube in this thread.)
- ispCP RC4 or later (if you upgraded to RC4 from an older version you have to set the database revision to 1 (mysql -> ispcp -> config) and check for database updates in the GUI (that's because of a bug in the update-script) / mail_addr should not be empty)

I assume that the roundcube-directory and the roundcube-user are both called roundcube.

In /var/www/ispcp/gui/tools/roundcube/program/steps/settings/func.inc before line 198

Code:
$out .= "\n</table>$form_end";

add this:

Code:
// Password MOD
  $field_id = 'rcmfd_password';
  $input_password = new passwordfield(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());
  // End Password MOD

In /var/www/ispcp/gui/tools/roundcube/program/steps/settings/save_prefs.inc at the beginning (line 22) add this:

Code:
require '../../include/ispcp-functions.php';

This includes the functions which we need to call the ispCP-daemon.
After approximately line 31

Code:
'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,

add this:

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

After approximately line 40

Code:
$a_user_prefs[$p] = $CONFIG[$p];

add this:

Code:
// Password MOD
if (isset($_POST['_password']) && $_POST['_password']!="")
  {
  $tmpPass = $_POST['_password'];
  $tmpUser = $_SESSION['username'];

  mysql_query("UPDATE ispcp.mail_users SET mail_pass='$tmpPass', status='change' WHERE mail_addr='$tmpUser'")
    or die(mysql_error());

  send_request();

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

Now we have to give the roundcube-user access to our mail_users table in the ispcp-database.
He will get only the minimum he needs: SELECT-privileges for mail_addr and UPDATE-privileges for mail_pass and status. You can do this with PMA or with the following SQL statements:

Code:
GRANT SELECT (`mail_addr`), UPDATE (`mail_pass`, `status`) ON `ispcp`.`mail_users` TO 'roundcube'@'localhost';
FLUSH PRIVILEGES;

Localization
You can translate the "(empty = unchanged)" string to your default language or remove it - it should be intuitive enough.

Test it!
After a change you will lose your connection to the IMAP server and have to login again.
Post improvements if you know some. I will merge them to a final HowTo in the docu.

This post was last modified: 04-06-2008 01:34 AM by Cube.

03-15-2008 11:22 PM
Find all posts by this user Quote this message in a reply
joximu
Moderator
*****


Posts: 3,534
Group: Moderators
Joined: Jan 2007
Status: Offline
Reputation: 47
Post: #2
RE: Password changer for Roundcube Webmail

Caution: this will work only with newer ispCP version (where mail_addr is filled in) - I think not in RC3 - nightly somewhat around end of february...


2008-03-16 ispCP RC4 released!!!
03-15-2008 11:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
elitepilot
Junior Member
*


Posts: 178
Group: Registered
Joined: Feb 2008
Status: Offline
Reputation: 0
Post: #3
RE: Password changer for Roundcube Webmail

does not work for rc3 stable release?


ISPCP RC6 Debian Etch 4.0, Virtual Server AMDX2 6000+ 1GB-3GB Awstats dynamic
03-16-2008 03:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
T0mcat
Junior Member
*


Posts: 46
Group: Registered
Joined: Feb 2007
Status: Offline
Reputation: 0
Post: #4
RE: Password changer for Roundcube Webmail

elitepilot Wrote:
does not work for rc3 stable release?


I'm running RC3, and this trick doesn't work for me Sad

But RC4 will be out soon, so it should work.


OS : Debian Etch 32bit
ispCP Version : RC4
AMD Athlon 64 X2 4200 Rootserver with 1 GB Ram
03-16-2008 04:12 AM
Find all posts by this user Quote this message in a reply
elitepilot
Junior Member
*


Posts: 178
Group: Registered
Joined: Feb 2008
Status: Offline
Reputation: 0
Post: #5
RE: Password changer for Roundcube Webmail

can make it able for rc3?


ISPCP RC6 Debian Etch 4.0, Virtual Server AMDX2 6000+ 1GB-3GB Awstats dynamic
03-16-2008 04:27 AM
Visit this user's website Find all posts by this user Quote this message in a reply
joximu
Moderator
*****


Posts: 3,534
Group: Moderators
Joined: Jan 2007
Status: Offline
Reputation: 47
Post: #6
RE: Password changer for Roundcube Webmail

with a much more complicated sql statement...


2008-03-16 ispCP RC4 released!!!
03-16-2008 04:33 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Cube
Documentation Team
***
Docu Team

Posts: 660
Group: Docu Team
Joined: Apr 2007
Status: Offline
Reputation: 8
Post: #7
RE: Password changer for Roundcube Webmail

That's the reason why I made it for newer ispCP versions (at least revision 1024 from the end of February). RC4 should be released soon, so please wait for it, if you use RC3.

03-16-2008 04:38 AM
Find all posts by this user Quote this message in a reply
gOOvER
Documentation Team
***
Docu Team

Posts: 1,526
Group: Docu Team
Joined: Jul 2007
Status: Online
Reputation: 13
Post: #8
RE: Password changer for Roundcube Webmail

elitepilot Wrote:
can make it able for rc3?


We don't need a Version for RC3. Rc4 is coming in the next few Days Smile


OS : Debian 4.0 Etch 64bit
ispCP Version : 1.0.0 r1335 - 27.08.08 (NightlyBuild)
Activated : AWStats dynamic
Mods : update via NightlyUpdateScript

!!! NO SUPPORT VIA PM OR EMAIL !!!
03-16-2008 04:39 AM
Visit this user's website Find all posts by this user Quote this message in a reply
elitepilot
Junior Member
*


Posts: 178
Group: Registered
Joined: Feb 2008
Status: Offline
Reputation: 0
Post: #9
RE: Password changer for Roundcube Webmail

i hope the update from rc3 to rc4 will go without erros ^^


ISPCP RC6 Debian Etch 4.0, Virtual Server AMDX2 6000+ 1GB-3GB Awstats dynamic
03-16-2008 07:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
elitepilot
Junior Member
*


Posts: 178
Group: Registered
Joined: Feb 2008
Status: Offline
Reputation: 0
Post: #10
RE: Password changer for Roundcube Webmail

Hi, i installed ISPCP RC4 But and follow your Howto, but i can not change Passwords.
mail_addr is empty in Database


ISPCP RC6 Debian Etch 4.0, Virtual Server AMDX2 6000+ 1GB-3GB Awstats dynamic
03-18-2008 10:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Pages (3): « First [1] 2 3 Next > Last »
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump:

| All rights reserved : isp-control.net |