+ Reply to Thread
Results 1 to 6 of 6

Thread: login and redirect to compose page

  1. #1
    aweirig is offline Registered User
    Join Date
    Oct 2008
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default login and redirect to compose page

    Hello,

    I'm trying to achieve to following transition into RC.

    Users login (userid + password) to our website.
    Somewhere on our site they find links to send emails to given adresses.

    When the user clicks on such a link, I would like to log the user into RC and direct him to the compose page showing a prepared email template (prefilled to, cc, bcc, subject, body etc),

    I can achieve both goals individually, i.e. I know how to log the user into RC using a standard form or even by passing the userid + password in the URL and slightly changing index.php to accept parameters from URL.
    I can also build a URL with _task=mail&_action=compose&...... to show the compose page ONCE the user is logged into RC.

    But currently I can't find a way to achieve both actions in "a single step".

    Any help is greatly appreciated.

    Alex

  2. #2
    rosali's Avatar
    rosali is offline Super Moderator
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    2,392
    Downloads
    36
    Uploads
    0

    Default

    I do not see the sense why you want to do this with RoundCube. There are lots of form mailer scripts which are much more suiteable for your purpose (f.e.: Class: sendmail (sendmail) - PHP Classes)
    Last edited by rosali; 10-22-2008 at 11:03 AM.

  3. #3
    aweirig is offline Registered User
    Join Date
    Oct 2008
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default

    Hi,

    thanks for answering my post.

    I agree with you and I know about those classes but in this very specific situation people must send those emails from their personal mailbox (i.e. the send email must show up in the Sent Items), the identity of the sender must be "guaranteed" through the mail client.

    We need this in an Intranet solution and have an obligation to work like this.

    I have done using Squirrelmail but I'm not too eager on using SM, I prefer RC but if RC can't be changed to support our needs, I'll have to go back to SM.

    Alex

  4. #4
    CarlB is offline Registered User
    Join Date
    Jun 2009
    Posts
    10
    Downloads
    1
    Uploads
    0

    Default

    I doubt Alex will see this seven months later but...

    It can be done.

    I am working on the same kind of thing and found this:

    Roundcube login via PHP script : Yet another web log

    you can change the redirect() redirect code to something like:

    $sendto = $_GET['sendto'];

    $rcl->redirect("?_task=mail&_action=compose&_to=$sendto ");


    I can get this script to meet my needs, but only when using clear text password! I can only pull my mail sites user name and a MD5 of the password from a cookie...

  5. #5
    rosali's Avatar
    rosali is offline Super Moderator
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    2,392
    Downloads
    36
    Uploads
    0

    Default

    By default RC does not store the password, not even an md5 hash of the password. The encrypted password is only available during a valid RC session.

    Perhaps I will write a plugin for RC 0.3 to store an md5 hash of the password in the user_prefs database field.

    Meanwhile you have to use the weak plain text method.
    Regards,
    Rosali

    __________________
    MyRoundcube Project http://myroundcube.googlecode.com
    MyRoundcube Online Demo - Free Email Address http://mail4us.net
    MyRoundcube Plugins Generic Installation Guide http://mail4us.net/myroundcube/index.php
    Mailing List http://mail4us.net/?_action=plugin.nabble

  6. #6
    rosali's Avatar
    rosali is offline Super Moderator
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    2,392
    Downloads
    36
    Uploads
    0

    Default

    Here is a plugin to get user's password.

    You get the md5 hash of the password by ...
    PHP Code:
    $hash md5(savepassword::getpw("myuser@mydomain.com")); 
    Plugin code (folder name "savepassword")
    PHP Code:
    <?php

    /**
     * Save password plugin
     *
     *
     * @version 1.0 - 21.06.2009
     * @author Roland 'rosali' Liebl
     * @website http://dl.roland-liebl.de/RoundCube/plugins/savepassword
     * @licence GNU GPL
     *
     *
     **/
     
    /** USAGE
     *
     * #1- Alter RoundCube Database table `users`:
     *
     *     ALTER TABLE `users` ADD `password` TEXT NULL AFTER `last_login` ;
     *
     * #2- Register plugin ("./config/main.inc.php ::: $rcmail_config['plugins']").
     * #3- Get the password when user is not logged in:
     *     
     *     $password = savepassword::getpw("myuser@mydomain.com");
     *
     **/
     
    class savepassword extends rcube_plugin
    {

        function 
    init()
        {
            
    $this->add_hook('login_after', array($this'savepw'));
        }

        function 
    savepw($args)
        {
        
            
    $rcmail rcmail::get_instance();

            if(
    $_SESSION['user_id']){ // user has been authenticated successfully
              
    $query "UPDATE `".get_table_name('users')."`
                    SET  password=? 
                    WHERE user_id=?;"
    ;
                      
              
    $ret $rcmail->db->query($query,$_SESSION['password'],$_SESSION['user_id']);
            
            }

            return 
    $args;
        }
        
        function 
    getpw($username){
        
            
    $rcmail rcmail::get_instance();    
        
            
    $rcmail->db->query("
                    SELECT * FROM "
    .get_table_name('users')."
                    WHERE  username=?"
    ,
                    
    $username);
                
            
    $user $rcmail->db->fetch_assoc();
            
            if(isset(
    $user['password'])){
              return 
    $rcmail->decrypt($user['password']);
            }
            else{
              return 
    false;
            }
        }

    }

    ?>
    Regards,
    Rosali

    __________________
    MyRoundcube Project http://myroundcube.googlecode.com
    MyRoundcube Online Demo - Free Email Address http://mail4us.net
    MyRoundcube Plugins Generic Installation Guide http://mail4us.net/myroundcube/index.php
    Mailing List http://mail4us.net/?_action=plugin.nabble

+ Reply to Thread

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