Author Topic: Custom login form on site  (Read 4658 times)

Offline iLean Solutions

  • Newbie
  • *
  • Posts: 9
    • http://www.ileansolutions.com
Custom login form on site
« on: October 18, 2010, 08:26:29 PM »
Hello everyone, I am using Roundcube on my Linux server for my clients, but instead of having my customers login through webmail and then having to chose Roundcube, I want to create a custom form for them within a subdomain on their own site that takes them directly to Roundcube; subdomain.domain.com  

I found the following code and it works, but for some reason it displays the Horde, Squirrell and Roundcube options for about 2 seconds and then automatically jumps into Roundcube. But I want it to jump straight into Roundcube.... Any suggestions or ideas? Thank you

Code: [Select]
<div id=&quot;content-wrap&quot;><form action=&quot;http://domain.com:2095/3rdparty/roundcube/?_task=mail&quot; method=&quot;post&quot;> <input name=&quot;login_theme&quot; type=&quot;hidden&quot; value=&quot;cpanel&quot; />
<table class=&quot;login&quot; style=&quot;width: 200px;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tbody style=&quot;text-align: left;&quot;>
<tr style=&quot;text-align: left;&quot;>
<td style=&quot;text-align: left;&quot;><strong>Login</strong></td>
<td style=&quot;text-align: left;&quot;>&nbsp;</td>
</tr>
<tr style=&quot;text-align: left;&quot;>
<td class=&quot;login_lines&quot; style=&quot;text-align: left;&quot;>Email:</td>
<td class=&quot;login_lines&quot; style=&quot;text-align: left;&quot;><input id=&quot;user&quot; name=&quot;user&quot; size=&quot;16&quot; type=&quot;text&quot; tabindex=&quot;1&quot; /></td>
</tr>
<tr class=&quot;row2&quot; style=&quot;text-align: left;&quot;>
<td class=&quot;login_lines&quot; style=&quot;text-align: left;&quot;>Password:</td>
<td class=&quot;login_lines&quot; style=&quot;text-align: left;&quot;><input id=&quot;pass&quot; name=&quot;pass&quot; size=&quot;16&quot; type=&quot;password&quot; tabindex=&quot;2&quot; /></td>
</tr>
<tr style=&quot;text-align: left;&quot;>
<td style=&quot;text-align: left;&quot; colspan=&quot;2&quot;><input id=&quot;login&quot; class=&quot;input-button&quot; type=&quot;submit&quot; value=&quot;Login&quot; tabindex=&quot;3&quot; /></td>
</tr>
</tbody>
</table>
<input name=&quot;goto_uri&quot; type=&quot;hidden&quot; value=&quot;/?login_theme=cpanel&quot; /> </form> <br /> <br />
<script type=&quot;text/javascript&quot;><!--
/* Must not include external javascript -jnk 06.20.09 */
var init = function() {
document.getElementById(&quot;user&quot;).value = '';
document.getElementById(&quot;pass&quot;).value = '';
document.getElementById(&quot;user&quot;).focus();
};
if( window.addEventListener ) {
window.addEventListener('load',init,false);
} else if( document.addEventListener ) {
document.addEventListener('load',init,false);
}
// --></script>
</div>

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,881
    • SKaero - Custom Roundcube development
Custom login form on site
« Reply #1 on: October 19, 2010, 05:42:21 AM »
That would be because of cPanel, you would need to change the JavaScript in cPanel for it not to show that screen.

Offline iLean Solutions

  • Newbie
  • *
  • Posts: 9
    • http://www.ileansolutions.com
Can you guide me
« Reply #2 on: October 19, 2010, 04:52:17 PM »
Thank you for your response, do you think you could tell me where in cPanel  I can go to modify this code? Thank you

Offline thomas_n

  • Newbie
  • *
  • Posts: 2
Slightly different situation, but maybe a solution
« Reply #3 on: December 29, 2010, 09:06:48 AM »
I had a similar problem, and maybe a solution for you.

My clients can access their Roundcube webmail from http://www.example.com/webmail (Bypassing cPanel). However I did not want them to see the Roundcube login screen.

So, I've made a jQuery script that fetches the login form, strips it and embeds it in my own page.

I've written a small tutorial on how to do this, it can be found on www.culturecrew.be/en/creative-code/roundcube-login-page/.

This approach works so long as the Roundcube installation resides on the same (sub-)domain as your page, because otherwise it would be considered cross-site scripting by your browser.

It may not be the exact solution for your problem, but it does show how to retrieve an external page, modify it and embed it in your own page. And that should get you a long way towards solving the problem I think.