firefox password manager popping up when asking for confirm.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

firefox password manager popping up when asking for confirm.

Post by kryles »

Hi,

I am testing something I'm working on in IE and Firefox. Basically the page lets users change profile information, but forces them to input their password to make the changes.

It works fine in I.E. but when I use FireFox the password manager pops up and asks the user if they want to change the password, even if it isn't the password they are changing.

Now, If I change the input type from password to text I don't get this problem but then the text is visible and I'd rather the ***** display (in PHP, so no javascript on KeyUp triggers).

Problem found on Line 80 below

Code: Select all

 
 
<p>This page allows for you to change Account information</p>
<br />Modify what needs to be changed, and leave the rest as is
 
<p>
<form name="frmChangeInfo" method="POST" action="<?php echo STOREURL."/profile.php?cinfo=&cinfo2=true"; ?>">
 
<table border="0" cellpadding="3">
    <tr>
        <td><font size="1">First Name: </font></td>
        <td><b><?php echo $row[0]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nFname" id="nFname" value="<?php echo $row[0]; ?>"></td>
    </tr>
    <tr>
        <td><font size="1">Last Name: </td>
        <td><b><?php echo $row[1]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nLname" id="nLname" value="<?php echo $row[1]; ?>"></td>
    </tr>
    <tr>
        <td><font size="1">Address: </td>
        <td><b><?php echo $row[2]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nAddress" id="nAddress" value="<?php echo $row[2]; ?>"></td>
    </tr>
    <tr>
        <td><font size="1">Apt: </td>
        <td><b><?php echo $row[3]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nAddress2" id="nAddress2" value="<?php echo $row[3]; ?>"></td>
    </tr>
    <tr>
            <td><font size="1">City: </td>
        <td><b><?php echo $row[4]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nCity" id="nCity" value="<?php echo $row[4]; ?>"></td>
    </tr>
    <tr>
        <td><font size="1">State: </td>
        <td><b><?php echo $row[5]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><select name="nState" id="nState"><?php getStates(); ?></select></td>
    </tr>
    <tr>
        <td><font size="1">Zip: </td>
        <td><b><?php echo $row[6]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nZip" id="nZip" value="<?php echo $row[6]; ?>"></td>
    </tr>
    <tr>
        <td colspan="3">Country: </td><td><b><?php echo $row[7]; ?></b></td>
    </tr>
    <tr>
        <td><font size="1">Phone: </td>
        <td><b><?php echo "(".substr($row[8],0,3).")".substr($row[8],4,3)."-".substr($row[8],6,4); ?></b></td>
        <td><font size="1">Change to -></td>
        <td>
            (<input type="text" name="nPhone1" id="nPhone1" maxlength="3" size="1" value="<?php echo substr($row[8],0,3); ?>" onkeyup="focusPhone(this);">)
            <input type="text" name="nPhone2" id="nPhone2" maxlength="3" size="1" value="<?php echo substr($row[8],4,3); ?>" onkeyup="focusPhone(this);"> -
            <input type="text" name="nPhone3" id="nPhone3" maxlength="4" size="2" value="<?php echo substr($row[8],6,4); ?>" onkeyup="focusPhone(this);">
        </td>
    </tr>
    <tr>
        <td><font size="1">Email: </td><td><b><?php echo $row[9]; ?></b></td>
        <td><font size="1">Change to -></td>
        <td><input type="text" name="nEmail" id="nEmail" value="<?php echo $row[9]; ?>"></td>
    </tr>
    <tr>
        <td><font size="1">Password: </td>
        <td><?php for($i=0; $i < strlen($row[10]);$i++) echo '*'; ?></td>
        <td><font size="1">Change to -></td>
        <td><input type="password" name="nPassword" id="nPassword" value=""></td>
    </tr>
    <tr>
        <td colspan="4" align="center"><p><font color="red">Fill in Current Password to Verify any changes made above<br />
 
<!-- PROBLEM ON LINE BELOW WHEN SET TO PASSWORD AND NOT TEXT-->
         <input type="text" name="oPassword" id="oPassword" value=""></font></p>
        </td>
    </tr>
    <tr>
        <td class="center" colspan="4"><input type="submit" value="Change Information" onclick="return ValidForm();"></td>
    </tr>
</table>
</form>
 
 
Hope someone knows what I'm talking about lol. Thanks
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Re: firefox password manager popping up when asking for confirm.

Post by mchaggis »

To my knowledge there is no solution to this as firefox is detecting the submition of a password field.

I didn't think it did that on a blank password submit?

The alternative is to use a little bit of javascript and a hidden input. Here is pseudo code (untested, just off top of head, so don't blame me):

Code: Select all

 
<input type="hidden" name="nPassword" id="nPassword" value="" />
<input type="text" value="" onchange="starme(this, 'nPassword')" />
 

Code: Select all

 
function starme(obj, id) {
    if (obj.value.length > document.getElementById(id).value.length) {
        document.getElementById(id).value += obj.value.substr(obj.value.length-1,1);
    }
 
    if (obj.value.length > 0) {
        // Update the hidden field
        document.getElementById(id).value = document.getElementById(id).value.substr(0,obj.value.length);
        // add a star
        obj.value += obj.value.substr(0, obj.value.length-1)+'*';
    }
}
 
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

Re: firefox password manager popping up when asking for confirm.

Post by kryles »

Hrm

Firefox -> :crazy:

I guess I'll put it as a text input type and see if people complain or anything. I'll keep the JavaScript in mind in case they do though hehe

Thanks
Post Reply