Author Topic: Need help with auto login or auto signup !  (Read 34716 times)

Offline sirola

  • Newbie
  • *
  • Posts: 1
Need help with auto login or auto signup !
« on: October 10, 2006, 09:48:28 AM »
Hello,

Is there any way I can pass parameters "username" and "password" to default RoundCube index.php file. I am trying to avoid login screen, because I know username and password and just want user to be redirected automatically to his/her mail account. Because I work mostly with ASP.NET and C#, I don't know PHP very good.

I have tried something like this:
http://mailserver.com/roundcube/index.php?_user=username&_pass=password
but I got login screen again.

Can somebody please help me with this.
Is that possible and if it is what I have to change and how to call URL for RoundCube webmail site.

So I need to avoid somehow login screen, I have "username" and "password" and want to be redirected to mail account promptly without entering username and password in text boxes.

By the way RoundCube is great, AJAX style, design, features, great work.

Regards to all,

Sirola
osirola@inet.hr

-----------------------------------------
hMailServer 4.2.1-B197 integrated MySQL
roundcubemail-0.1beta2
Windows 2003 Server, IIS 6.0
-----------------------------------------

Offline helga

  • Jr. Member
  • **
  • Posts: 17
Re: Need help with auto login or auto signup !
« Reply #1 on: October 12, 2006, 07:43:22 AM »
search in index.php:

Code: [Select]
else if (isset($_POST['_user']) && isset($_POST['_pass']) &&
      rcmail_login(get_input_value('_user', RCUBE_INPUT_POST), $_POST['_pass'], $host))
  {

change to:

Code: [Select]
else if (isset($_REQUEST['_user']) && isset($_REQUEST['_pass']) &&
      rcmail_login(get_input_value('_user', RCUBE_INPUT_POST), $_REQUEST['_pass'], $host))
  {

Offline luizbox

  • Newbie
  • *
  • Posts: 1
Re: Need help with auto login or auto signup !
« Reply #2 on: November 01, 2006, 04:22:46 PM »
I need the same fix for my pages, but this displayed here don't give right... Had something else that need to be configured for work!?

Offline MylesHawkins

  • Newbie
  • *
  • Posts: 1
Re: Need help with auto login or auto signup !
« Reply #3 on: November 28, 2006, 11:15:38 AM »
After changing the $_POST's to $_REQUEST's you need to pass it a url like:

http://mailserver.com/roundcube/index.php?_user=[YOURUSERNAMEHERE]&&_pass=[YOURPASSWORDHERE]&&_action=login"

Offline Octavius

  • Jr. Member
  • **
  • Posts: 16
Re: Need help with auto login or auto signup !
« Reply #4 on: February 14, 2007, 04:46:04 AM »
Hello, Many thanks for this superb Webmail. I'm trying to pass login and password parameters like explained in this post but it's not working. I'm using the last version of Round Cube.

Could you please help me ?

Many many thanks,

Steve.

Offline road

  • Newbie
  • *
  • Posts: 6
Re: Need help with auto login or auto signup !
« Reply #5 on: February 21, 2007, 01:39:43 PM »
We actually made our own form and posted it to round cube automatically with javascript. Basically they had already logged in so we can use the same credentials. We are using coldfusion but you can translate the idea to anything you want. This is a form we added to the roundcube root directory.



   
      
      
      
   

   



Offline Octavius

  • Jr. Member
  • **
  • Posts: 16
Re: Need help with auto login or auto signup !
« Reply #6 on: March 08, 2007, 09:34:10 AM »
Hello Road, many thanks for your help. I will try your solution.
But i'm wondering if it's not possible to pass parameters in the URL like in this solution :

http://mailserver.com/roundcube/index.php?_user=[YOURUSERNAMEHERE]&&_pass=[YOURPASSWORDHERE]&&_action=login"

Many thanks,

Octavius.

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Re: Need help with auto login or auto signup !
« Reply #7 on: March 10, 2007, 12:58:39 PM »
You have to pass the parameters like that.

The only other way you can do this is via PHP. That way your details are secure as they cannot be seen.

road's way would be like this in pure HTML.

Code: [Select]
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;[url]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/url]
<html xmlns=&quot;[url]http://www.w3.org/1999/xhtml&quot;>[/url]
<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; />
<title>Logging You In..</title>
</head>

<body onload=&quot;document.rcLogin.submit();&quot;>
<center>Please Wait..</center>
<form id=&quot;rcLogin&quot; name=&quot;rcLogin&quot; method=&quot;post&quot; action=&quot;[url]https://neoboffinhosting.com/webmail/rc/&quot;>[/url]
<input type=&quot;hidden&quot; name=&quot;_action&quot; value=&quot;login&quot; />
<input type=&quot;hidden&quot; name=&quot;_user&quot; value=&quot;type_ya_email_here&quot; />
<input type=&quot;hidden&quot; name=&quot;_pass&quot; value=&quot;type_ya_password_here&quot; />
</form>
</body>
</html>

Offline Octavius

  • Jr. Member
  • **
  • Posts: 16
Re: Need help with auto login or auto signup !
« Reply #8 on: March 14, 2007, 06:56:28 AM »
Stevie, you're the best !!! it's working.

Many thanks for your help, I will try with PHP variables.

Have a nice day,

Steve.

Offline aclertant

  • Newbie
  • *
  • Posts: 5
Re: Need help with auto login or auto signup !
« Reply #9 on: March 15, 2007, 06:50:33 AM »
Hello,

I tried the Stevie solution and it work almost for me but i use something not elegant.

Do I need to change $_request to $_post too ?

So I have a page with few tabs and one of them open an Iframe with : src="test.html"
In test.html I put only the Stevie script.

It work in IE but not in Firefox (display just "Please wait...")

If I load directly test.html it's almost the same, work well in IE, but at the first load of test.html in firefox RC display an erreur (your browser does not accept cookies) if I reload the test.html it's working ???

Any idea ?

Thanks for your help.

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Re: Need help with auto login or auto signup !
« Reply #10 on: March 15, 2007, 06:58:18 AM »
Possibly your Cookie settings in FireFox..

Check them to see if you have enabled cookies.

You don't need to change anything RoundCube using my solution.

Offline aclertant

  • Newbie
  • *
  • Posts: 5
Re: Need help with auto login or auto signup !
« Reply #11 on: March 15, 2007, 09:15:57 AM »
Hello Stevie,

I tried a lot of things but nothing success realy.

You look like a good developper ;) your tip is nice and work well, and that my fault if your code dont work.

So that why I ask you what do you think about my problem and what would be the best way to do something like this


My main page will be turn to a php page with (or not I hope not) an iframe to display the RC.

ps: My tabs is a switch div not an ajax call

Thanks you very much, Andre

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Re: Need help with auto login or auto signup !
« Reply #12 on: March 15, 2007, 10:10:28 AM »
If you try to include RoundCube directly into a PHP page, your styles (CSS) will get messed up for a start. Then if the developer of RoundCube has made it so that it can work via an include it should run fine and all you need to worry about is the CSS styles.

However, should it not, you've got alot of re-coding todo.

Your best method is actually an iframe as this will work like normal.

For me, this works:

Code: [Select]
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;[url]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/url]
<html xmlns=&quot;[url]http://www.w3.org/1999/xhtml&quot;>[/url]
<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; />
<title>Please Login</title>
</head>

<body>
<center>
<form id=&quot;rcLogin&quot; name=&quot;rcLogin&quot; method=&quot;post&quot; action=&quot;[url]https://neoboffinhosting.com/webmail/rc/&quot;[/url] target=&quot;rcFrame&quot;>
<input type=&quot;hidden&quot; name=&quot;_action&quot; value=&quot;login&quot; />
Email: <input type=&quot;text&quot; name=&quot;_user&quot; />
Password: <input type=&quot;password&quot; name=&quot;_pass&quot; />
<input name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; />
</form>
<br /><br />
<iframe src=&quot;[url]https://neoboffinhosting.com/webmail/rc/&quot;[/url] id=&quot;rcFrame&quot; name=&quot;rcFrame&quot; frameborder=&quot;0&quot; height=&quot;550&quot; width=&quot;700&quot;>Your browser doesn't support iframes.</iframe>
</center>
</body>
</html>

As does this (just an iframe):

Code: [Select]
[/url]
[/url]


Please Login








Offline aclertant

  • Newbie
  • *
  • Posts: 5
Re: Need help with auto login or auto signup !
« Reply #13 on: March 15, 2007, 11:51:46 AM »
Thank you very much Stevie for spendind time to help me.

Actualy I need both iframe and auto login and I think I got a session trouble because the session id cant be read by my main page, but let my try to put my code as you do :P

main.html
Code: [Select]
<html>
<head></head>
<body>
<iframe id=&quot;rcframe&quot; name=&quot;rcframe&quot; src=&quot;test.html&quot; marginheight=&quot;0px&quot; marginwidth=&quot;0px&quot; height=&quot;500px&quot; width=&quot;720px&quot; frameborder=&quot;0&quot;></iframe>
</body>
</html>

test.html
Code: [Select]
[/url]
[/url]


Logging You In..


Please Wait..

[/url]







The code I reply is working :'( Because I tried to upload a page like the main.html here and it's work, but mine is not so simple of course...

I'll try to cut some others scripts in my big main.html and come back.

An other way could be to create a session in the main.html php ;)
And try to load an iframe src="http://www.mydomain.co.uk/webmail/index.php" by a normal way...

if the session is set already, RC should detect it and go to ?task=mail ?? no?

Any idea to do this ? (I know it's a big challenge)

Did you found somethings wrong in what Im replying ?

Many many thanks Stevie :)
sincerly, Andre

Offline Stevie

  • Jr. Member
  • **
  • Posts: 29
Re: Need help with auto login or auto signup !
« Reply #14 on: March 15, 2007, 12:18:14 PM »
This is a quote from a forum. Unfortunatley, I'm too busy to mess around with the code to build something for you. However, if you understand it, you might be able to build it yourself.

Code: [Select]
you may try to do a little trick:
on the main page form submit you open up a temporary window where you can store in javascript the variables that you posted. Then once the main page is loaded with the target page, you grab into javascript the values from the temporary window and close it.
Not so elegant but should work.