Author Topic: RoundCube Allow user to change password  (Read 4910 times)

Offline tobelyan

  • Newbie
  • *
  • Posts: 3
RoundCube Allow user to change password
« on: November 01, 2013, 03:13:00 AM »
Hi everyone,
i got a problem - well i am using RoundCube and my users can't change password,
so i am using ISP Manager, on CentOS 6
what i have done:
Edited this line: $rcmail_config['plugins'] = array();
to: $rcmail_config['plugins'] = array(‘password’);
and now i have an option about changing my password
but when i am trying to change it am getting an error something like" Can't save password"
i guess it's database problem, so maybe somebody can help me with this?

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,882
    • SKaero - Custom Roundcube development
Re: RoundCube Allow user to change password
« Reply #1 on: November 01, 2013, 03:44:28 AM »
You need to configure the password plugin for your environment, read the README file in the password plugin folder.

Offline tobelyan

  • Newbie
  • *
  • Posts: 3
Re: RoundCube Allow user to change password
« Reply #2 on: November 01, 2013, 05:29:05 AM »
sorry i am new, i don't understand what i should do, where to change,
like my database name is:  roundcubemail
database user: roundcube
pass: somepass

CREATE OR REPLACE FUNCTION update_passwd(hash text, account text) RETURNS integer AS $$
   DECLARE
           res integer;
   BEGIN
           UPDATE passwd SET password = hash
       WHERE login = split_part(account, '@', 1)
      AND domainid = (SELECT id FROM domains WHERE name = split_part(account, '@', 2))
       RETURNING id INTO res;
       RETURN res;
   END;
   $$ LANGUAGE plpgsql SECURITY DEFINER;

 - This is for use with a SELECT update_passwd(%o,%c,%u) query
   Updates the password only when the old password matches the MD5 password
   in the database

   CREATE FUNCTION update_password (oldpass text, cryptpass text, user text) RETURNS text
           MODIFIES SQL DATA
   BEGIN
       DECLARE currentsalt varchar(20);
       DECLARE error text;
       SET error = 'incorrect current password';
       SELECT substring_index(substr(user.password,4),_latin1'$',1) INTO currentsalt FROM users WHERE username=user;
       SELECT '' INTO error FROM users WHERE username=user AND password=ENCRYPT(oldpass,currentsalt);
       UPDATE users SET password=cryptpass WHERE username=user AND password=ENCRYPT(oldpass,currentsalt);
       RETURN error;
   END