+ Reply to Thread
Results 1 to 6 of 6

Thread: Custom login and logout scripts

  1. #1
    pedrusko is offline Registered User
    Join Date
    Feb 2009
    Location
    Burgos, Spain
    Posts
    4
    Downloads
    1
    Uploads
    0

    Default Custom login and logout scripts

    Hello all,

    I think it would be nice to have a custom login and logout scripts.

    i.e. a place to change the username or server provided by the uses.

    I have now squirrelmail with custom login plugin that matches mail domains to servers, and changes username in a form the server can use.

    The user writes his/her mail address as login, and then it is rewited like:

    user1@domaina.tld -> username = user1, server = server 1
    user2@domainb.tld -> username = user2.domaind.tld, server = server 2

    I use a single page for login to various servers with different configurations.

    I think it could be a nice feature.

    Thanks to all for this great software

  2. #2
    oSIRus is offline Registered User
    Join Date
    Feb 2009
    Posts
    1
    Downloads
    1
    Uploads
    0

    Default

    Hello pedrusko,

    very interesting, because I need to provide similar functionality for our school.

    Did you use the plugin architecture?

    I already tried to implement the sample plugin (automatic login if on localhost, URL), but it doesn't seem to work. Do you somehow have to activate the plugin architecture in the first place?

    Thank you,

    oSIRus

  3. #3
    pedrusko is offline Registered User
    Join Date
    Feb 2009
    Location
    Burgos, Spain
    Posts
    4
    Downloads
    1
    Uploads
    0

    Default

    Hello,

    The plugin is for squirrelmail only

    Is there a document explaining the plugin interface?
    I could adapt the plugin or make a new one if necessary.

    I'm working for an academic institution too

    Regards,

    Pedro

  4. #4
    pedrusko is offline Registered User
    Join Date
    Feb 2009
    Location
    Burgos, Spain
    Posts
    4
    Downloads
    1
    Uploads
    0

    Default

    As seen on roadmap, plugins will not be available until 0.3

    Roadmap ? RoundCube Webmail ? Trac

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

    Default

    There is no documentation yet. But you can analize the example plugins ...

    /branches/devel-api ? RoundCube Webmail ? Trac
    Last edited by rosali; 02-09-2009 at 03:37 PM.
    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
    pedrusko is offline Registered User
    Join Date
    Feb 2009
    Location
    Burgos, Spain
    Posts
    4
    Downloads
    1
    Uploads
    0

    Default Sample plugin

    I have made a sample plugin, not tested yet.

    Any suggestions would be apreciated


    File milogin.php
    PHP Code:
    <?php
    // Change username / host based on email address.
    // Author: Pedro R. Benito <pedro@ubu.es>
    // Last modified: 09/02/2009
    //
    // 1.- User enters email address instead username.
    // 2.- Username and host are selected automaticaly.

    class milogin extends rcube_plugin
    {
        function 
    init()
        {
            
    $this->add_hook('startup', array($this'startup'));
            
    $this->add_hook('authenticate', array($this'authenticate'));
        }

        function 
    startup($args)
        {
            
    $rcmail rcmail::get_instance();
            
            return  
    $args;
        }
        
        function 
    authenticate($args)
        {
            
    // File containing domain names and associated config.
            // Sample content:
            //
            // <?php
            // $domains = array();
            //
            // $domains['domain1.tld']['type'] = 'simple';
            // $domains['domain1.tld']['host'] = 'host.name.tld';
            // ? >
            
    include 'milogin_domains.conf.php';
            
            
    // Discover user and domain name.
            // $parts[0] holds login name.
            // $parts[1] holds domain name.
            
    $parts explode('@',$args['user']);
            
            switch(
    $domains[$parts[1]]['type'])
            {
                case 
    'simple':
                    
    // username = login name
                    
    $args['username'] = $parts[0];
                    break;
                case 
    'dotted':
                    
    // username = loginname.domainname
                    
    $args['username'] = $parts[0].".".$parts[1];
                    break;
                    
            }

            
    // Extract host from domain config.
            
    $args['host'] = $domains[$parts[1]]['host'];
            
            return 
    $args;
        }
    }

    ?>
    File milogin_domains.conf.php
    PHP Code:
    <?php
    $domains 
    = array();

    $domains['domain1.tld']['type'] = 'simple';
    $domains['domain1.tld']['host'] = 'server1.tld';

    $domains['domain2.tld']['type'] = 'dotted';
    $domains['domain2.tld']['host'] = 'server2.tld';

    ?>

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Tags for this Thread

Posting Permissions

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