The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automatic Horde Login

Discussion in 'General Discussion' started by olliemaitland, May 12, 2004.

  1. olliemaitland

    olliemaitland Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    I searched around for a simple script to login to the horde email system without entering all the various username and passwords and came up with this.

    THis is after the IE patch with prevents authenticating in the URL. I have implemented with in my site but here are the basic forms which you can modify to your own means:


    This is the basic login form:

    Code:
    <script type="text/javascript">
    function load_wm () {
    document.getElementById('wm').user.value=document.getElementById('login').user.value + '@' + document.getElementById('login').domain.value ;
    document.getElementById('wm').pass.value=document.getElementById('login').pass.value;
    document.getElementById('wm').action='http://www.'+ document.getElementById('login').domain.value +':2095/login';
    document.getElementById('wm').submit();
    }
    </script>
    <form id="wm" action="" target="webmail" style="margin:0px;" method=post>
    <input type="hidden" name="user" value="">
    <input type="hidden" name="pass" value="">
    <input type="hidden" name="domain" value="">
    </form>
    <div style="padding:20px;">
    <form id="login" action="" method="post" onsubmit="javascript:load_wm();">
    <div style="position:absolute; vertical-align:top; float:left;">Username :</div><div style="padding-left:150px; "><input type="text" name="user" value="" style="width:200px;" ></div>
    <br /><div style="position:absolute; vertical-align:top; float:left;">Password :</div><div style="padding-left:150px; "><input type="password" name="pass" value="" style="width:200px;"></div>
    <br /><div style="position:absolute; vertical-align:top; float:left;">Domain :</div><div style="padding-left:150px; "><select name="domain" style="width:200px;">
    <option value="server1.com">server1.com</option>
    <option value="server2.com">server2.com</option>
    </select></div>
    <br /><input type="hidden" name="action" value="login">
    <div style="padding-left:300px; position:absolute;"><input type="submit" value="Login"></div><br />
    <br /></form>
    </div>
    
    So basically this just refreshes itself....

    then in php you can see when action==login i just printed the script :

    Code:
    <form id="reload" action="http://www.server1.com:2095/horde/imp/redirect.php" target="webmail" style="margin:0px;" method=post>
    <input type="hidden" name="imapuser" value="user@server1.com">
    <input type="hidden" name="pass" value="password">
    <input type="hidden" name="maildomain" value="">
    <input type="hidden" name="protocol" value="imap/notls">
    <input type="hidden" name="server" value="localhost">
    <input type="hidden" name="port" value="143">
    </form>
    <script type="text/javascript">
    setTimeout("document.getElementById('reload').submit()",1000);
    </script>
    
    obviiously you need to use php a bit to make the usernames etc correct...

    the pause is needed to allow for the authentication, if you are on a slow connection you may need to increase this.

    Essentially all this script does it to reload the popup window, i fear that popup killer may not like this very much although it is submitting forms so it could be ok...

    Hope this helps anyone trying to figure out a method to this... i have it running at

    http://wmail.byng-designs.com if you want to see it in action (with fixed domains though =] )

    If anyone wants me to explain this alittle better - drop me an email :)
     
  2. tabish

    tabish Registered

    Joined:
    Jun 8, 2004
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    new delhi india
    usefull script.. but it is loggin in webmail .. not directly to horde

    how can we login directly to horde?

    please explain..

    regards
     
  3. abubin

    abubin Well-Known Member

    Joined:
    Dec 7, 2004
    Messages:
    393
    Likes Received:
    1
    Trophy Points:
    18
Loading...

Share This Page