HOWTO: Add a 'Change Password' button to SquirrelMail

mattb

Verified User
Joined
Mar 31, 2005
Messages
170
Location
Melbourne, Australia
Many users want a quick and easy way to change their Email password.

This patch allows you to change the login form of SquirrelMail so a 'Change Password' button appears.

Example:
webmail7ii.png


  1. cd /var/www/html/squirrelmail/src
  2. vi login.php
  3. Look for the following
    Code:
    <center>'. addSubmit(_("Login"))
  4. Replace the line with:
    Code:
    '<center>'. addSubmit(_("Login")) .'<INPUT TYPE=button VALUE="Change Password" onClick="window.location.href=\'http://' .  $_SERVER['HTTP_HOST'] . ':2222/CMD_CHANGE_EMAIL_PASSWORD\'"></center>',
  5. Save the file and exit.
    [/list=1]

    Reload the Webmail system and you should be set. ;)
 
There are some problems with the quote marks. (Actually, you probably had the same problems as me. The forum won't display the escape character slashes!).

Attached is the text that you need to change. It works, I've tested it.

Louie
 

Attachments

  • squirrel-mail-pass-button.txt
    572 bytes · Views: 3,317
I have this exactly now:

Code:
                    html_tag( 'td',
                        '<center>'. addSubmit(_("Login")) .'<INPUT TYPE=button VALUE="Change Password" onClick="window.location.href='http://' . $_SERVER['HTTP_HOST'] . ':2222/CMD_CHANGE_EMAIL_PASSWORD'"></center>',
                    'left' )

I still get this error:

Parse error: parse error, unexpected T_STRING in /var/www/html/squirrelmail-1.4.4/src/login.php on line 147

Any help?

Thanks!
 
Sorry guys...

I've been away a few days.

It appears you've all got it worked out. :D

If you are still having difficulties... I've included by modified login.php file for you to use.

I recommend you do a 'diff' against your current one to see the variations. ;)

Good luck! :cool:
 

Attachments

  • login.php.txt
    6 KB · Views: 2,497
I do have a real quick question... Is there a way to make it come back to webmail login screen after it changes password instead of the directadmin login screen?

Other then that... works great! DA should add this. :)
 
This button would allow anyone to change a password for an email account. What am I missing?
 
In order to change the password they have to know the old password. That's the traditional information needed to change a password in most systems. What would you prefer they be asked to identify themselves? Their mother's maiden name :) ?

Jeff
 
From the example above, I did not see where it asked for your current password. Perhaps the code did not work in my login page because all that happens when I hit change password, is it routes me to the DA login screen.

J you're in the wrong field. There's a few spots at the comic strip waiting for you:)
 
It should have rerouted you to the da change email password screen, which asks for the old password.

Yes, I used to write comedy, for a friend who was a commediane.

Jeff
 
:) I will try it again, it simply redirected me to the DA login, not the change password screen.
 
rldev,

I didn't realize you were referring to a php file attached to the thread :( .

I have no idea of how that thread works.

My own squirrelmail page at da1.namelessnet.net/squirrelmail will show you how I did it.

Jeff
 
String is closed with ' to use it as string value use \' , try this (worked fine to me)

Code:
'<center>'. addSubmit(_("Login")) .'<INPUT TYPE=button VALUE="Change Password" onClick="window.location.href=[COLOR=red]\[/COLOR]'http://' . $_SERVER['HTTP_HOST'] . ':2222/CMD_CHANGE_EMAIL_PASSWORD[COLOR=red]\[/COLOR]';">'.'</center>',

PS. if you use secure connection (https) on DA you must use https instread http in the code above.

:)
 
Last edited:
Hi folks,


Ubuntu 7.04 server amd64


Just found this thread on googling.

Replaced louie55's squirrel-mail-pass-button.txt on /usr/local/squirrelmail/www/src/login.php


Started SquirrelMail on Firefox;

https://localhost/squirrelmail

Typed in Name and Password.

on clicking [Change Password] popup
Code:
Unable to connect         

Firefox can't establish a connection to the server at localhost:2222.
Would it be port 2222 blocked up ISP ???

$ telnet localhost 2222
Code:
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
Can I use another port?

TIA


B.R.
satimis
 
localhost refers to the local machine. When you use localhost from firefox it doesn't try the DirectAdmin server; it tries your desktop system.

Jeff
 
localhost refers to the local machine. When you use localhost from firefox it doesn't try the DirectAdmin server; it tries your desktop system.
Hi Jeff,


Thanks for your advice.


https://domain.com/squirrelmail
and
https://localhost/squirrelmail

same situation starts squirrel webmail. Clicking "Change Password" with following notice popup finally,
Code:
Unable to connect

Firefox can't establish a connection to the server at domain.com:2222.(or localhost:2222)


Each day switch on the PC the 1st time and run;

https://domain.com/squirrelmail
OR
https://localhost/squirrelmail

following warning popup
Code:
Following warning popup;
Security
security Error: Domain Name Mismatch
You have attempted to establish a connection with
"www.domain.com".  However, the security certificate
presented belongs to "localhost".  It is possible though
unlikely, that someone may be trying to intercept your
communication with this website.


If you suspect the certicate shown does not belong to
"www.domain.com". please cancel the connection and notify
the site administrator.

[Vies Certificate]     [Cancel]  [OK]
Clicking [OK] starts squirrel webmin. The webmail works fine w/o problem.

Whether I have to buy a security certificate?


Any suggestion to try? TIA


B.R.
satimis
 
None of your links point to your server so there's no way to look at your configuration.

Jeff
 
None of your links point to your server so there's no way to look at your configuration.
Hi Jeff,


This box is for testing only. I must run "iptables -F" to flush the rules otherwise squirrelmail can't work on Internet.

Please advise which configuration you need to check. I'll post it on the forum. Thanks.


satimis
 
Last edited:
Back
Top