+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18

Thread: Password Plugin

  1. #11
    sasi is offline Registered User
    Join Date
    Jul 2010
    Posts
    17
    Downloads
    0
    Uploads
    0

    Default password plugin

    Quote Originally Posted by rosali View Post
    Yes, kmn. Could you assist to setup the default password plugin for Dovecot/Postfix?
    HI KNM& Rosali,

    In the version 0.3.1 the roundcube having the password plugin content,In my case i have enabled the password in the array in main.inc.php and i want to conect the password plugin with the MYSQL DB to save the details,

    Now iam getting connection error and iam attaching the screen shot
    has i came threw some document they mentioned to work with password_db_dsn and password_query so please help to finish up this problem


    // PEAR database DSN for performing the query. By default
    // Roundcube DB settings are used.
    $rcmail_config['password_db_dsn'] ='mysql://roundcube:forever@localhost';

    // The SQL query used to change the password.
    // The query can contain the following macros that will be expanded as follows:
    // %p is replaced with the plaintext new password
    // %c is replaced with the crypt version of the new password, MD5 if available
    // otherwise DES.
    // %o is replaced with the password before the change
    // %n is replaced with the hashed version of the new password
    // %q is replaced with the hashed password before the change
    // %h is replaced with the imap host (from the session info)
    // %u is replaced with the username (from the session info)
    // %l is replaced with the local part of the username
    // (in case the username is an email address)
    // %d is replaced with the domain part of the username
    // (in case the username is an email address)
    // Escaping of macros is handled by this module.
    // Default: "SELECT update_passwd(%c, %u)"
    $rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';
    Attached Images

  2. #12
    Schmatze is offline Registered User
    Join Date
    Apr 2010
    Posts
    28
    Downloads
    0
    Uploads
    0

    Default

    I'm tryng to get this plugin running. But I allways get this error-message:

    DB Error: MDB2 Error: syntax error Query: _doQuery: [Error message: Could not execute statement] [Last executed query: see_next_code_block] [Native code: 1064] [Native message: You have an error in your SQL syntax; check the m in /path/to/roundcube/program/include/rcube_mdb2.php on line 644 (POST /?_task=settings&_action=plugin.password-save?_task=&_action=)
    Here is my query (which works fine in phpmyadmin):
    $rcmail_config['password_query'] = 'CREATE TEMPORARY TABLE userID (SELECT `id` FROM `virtual_users` WHERE `domain_id` =(SELECT `id` FROM `virtual_domains` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )); UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` =(SELECT `id` FROM userID) LIMIT 1 ;';
    I don't understand this error-message. I hope you does. Thanks.

  3. #13
    skaero's Avatar
    skaero is online now Administrator
    Join Date
    Jun 2006
    Location
    USA - New Mexico
    Posts
    2,092
    Downloads
    5
    Uploads
    0

    Default

    At the end of your query you have:
    Code:
    ;';
    the first ; shouldn't be there, it should be:
    Code:
    $rcmail_config['password_query'] = 'CREATE TEMPORARY TABLE userID (SELECT `id` FROM `virtual_users` WHERE `domain_id` =(SELECT `id` FROM `virtual_domains` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )); UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` =(SELECT `id` FROM userID) LIMIT 1';
    EDIT: Oops I just read your query a little bit closer and noticed that you trying to run 2 query, RoundCube only supports running 1 query.
    Last edited by skaero; 08-18-2010 at 03:13 PM.

  4. #14
    Schmatze is offline Registered User
    Join Date
    Apr 2010
    Posts
    28
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by skaero View Post
    Oops I just read your query a little bit closer and noticed that you trying to run 2 query, RoundCube only supports running 1 query.
    Do you have any suggestion how I can change this?

    The problem is, that I need the id of the user, so I have to select the same table I want to update. And MySQL doesn't like this in one query.

  5. #15
    skaero's Avatar
    skaero is online now Administrator
    Join Date
    Jun 2006
    Location
    USA - New Mexico
    Posts
    2,092
    Downloads
    5
    Uploads
    0

    Default

    Can you do:
    Code:
    $rcmail_config['password_query'] = 'UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` = (SELECT `id` FROM `virtual_users` WHERE `domain_id` = (SELECT `id` FROM `virtual_domains` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )) LIMIT 1';
    Or does that also return a error (and if so what error)

  6. #16
    Schmatze is offline Registered User
    Join Date
    Apr 2010
    Posts
    28
    Downloads
    0
    Uploads
    0

    Default

    This was the first one I tried. Doesn't work either.

    Code:
    You can't specify target table 'virtual_users' for update in FROM clause
    Thats why I tried it with a temporary table.

  7. #17
    skaero's Avatar
    skaero is online now Administrator
    Join Date
    Jun 2006
    Location
    USA - New Mexico
    Posts
    2,092
    Downloads
    5
    Uploads
    0

    Default

    Ok I think its just a mysql format problem, try this:
    Code:
    $rcmail_config['password_query'] = 'UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` = (SELECT `id` FROM `mail`.`virtual_users` WHERE `domain_id` = (SELECT `id` FROM `mail`.`virtual_users` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )) LIMIT 1';

  8. #18
    Schmatze is offline Registered User
    Join Date
    Apr 2010
    Posts
    28
    Downloads
    0
    Uploads
    0

    Default

    Ok, I made a view now with the password and the mail-address inside.

    Works fine now.

    Here is my query:

    Code:
    UPDATE `mail`.`view_users` SET `password` = MD5( %p ) WHERE `email` = %u AND `password` = MD5( %o ) LIMIT 1
    Thanks for your help.

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts