Roundcube Community Forum

 

Custom login form on site

Started by iLean Solutions, October 18, 2010, 08:26:29 PM

Previous topic - Next topic

iLean Solutions

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

<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>

SKaero

That would be because of cPanel, you would need to change the JavaScript in cPanel for it not to show that screen.

iLean Solutions

Thank you for your response, do you think you could tell me where in cPanel  I can go to modify this code? Thank you

thomas_n

I had a similar problem, and maybe a solution for you.

My clients can access their Roundcube webmail from //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.