Kërkoni te Asistenca

Shmangni karremëzime gjoja asistence. S’do t’ju kërkojmë kurrë të bëni një thirrje apo të dërgoni tekst te një numër telefoni, apo të na jepni të dhëna personale. Ju lutemi, raportoni veprimtari të dyshimtë duke përdorur mundësinë “Raportoni Abuzim”.

Mësoni Më Tepër

How to force save username password?

  • 8 përgjigje
  • 6 e kanë hasur këtë problem
  • 7 parje
  • Përgjigjja më e re nga FAnDwyHSHoo2K

more options

Hi everyone,

Is there any way to force Firefox to save username password of a site that refuses?

I have tried the JavaScript bookmarklets in this page but they do not work. http://kb.mozillazine.org/User_name_and_password_not_remembered

The page in question is from a TP Link Modem Router Archer D7. Following is the source code of the login page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8" />
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Expires content=0>
<style type="text/css">
body
{
	font-family:Arial, sans-serief;
	background-color:#E5E5E5;
	margin:0px;
	padding:0px;
}
div.loginBox
{
	display: block;
	position:relative;
	margin-top:10%;
	text-align:center;
}
.noteDiv
{
	color:gray;	
	font-family:Arial;	
	width:395px;	
	text-align:left;	
	margin:0px auto;	
	font-size:14px;
}
#note
{
	display:inline-block;
	vertical-align:top;
	_display:inline;
	_zoom:1;
	width:50px;
	font-weight:bold;
}
#tip
{
	display:inline-block;
	vertical-align:top;
	_display:inline;
	_zoom:1;
	width:340px;
}
div.panelThre
{
	margin-top:10px;
}
div.picDiv
{
	width:395px;
	height:276px;
	background:url(../img/login/bg2.png);
	position:relative;
}
input.pcPassword
{
	width:300px;
	height:50px;
	line-height:50px;
	padding-left:20px;
}
ul
{
	padding:60px 0px 0px 0px;
	margin:0px;
	list-style:none;
}
ul li
{
	height:34px;
	width:222px;
}
li.unLi
{
	background:url(../img/login/idunselect.png);
}
li.pwLi
{
	background:url(../img/login/pwunselect.png);
}
li.blank
{
	height:15px;
}
button.loginBtn
{
	border:none;
	height:34px;
	display:inline-block;
	width:113px;
	margin-top:30px;
	background:url(../img/login/login.png);
	cursor:pointer;
}
input.text
{
	border:0px;
	height:26px;
	line-height:26px;
	width:175px;
	padding:0px;
	margin:4px 0px 0px 30px;
	font-size:14px;
	color:#6a6969;
	font-family:"Verdana","Arial";
	outline: none;
}
#copyright
{
	-webkit-text-size-adjust:none;
	font-size:9px;
	color:#6a6969;
	font-family:"Verdana";
	margin-top:40px;
	display:inline-block;
}
</style>

<script type="text/javascript">
var isLocked = false;
function Base64Encoding(input) 
{
	var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	var output = "";
	var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
	var i = 0;
	input = utf8_encode(input);
	while (i < input.length) 
	{
		chr1 = input.charCodeAt(i++);
		chr2 = input.charCodeAt(i++);
		chr3 = input.charCodeAt(i++);
		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;
		
		if (isNaN(chr2)) 
		{
			enc3 = enc4 = 64;
		} 
		else if (isNaN(chr3)) 
		{
			enc4 = 64;
		}
		output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
	}
	return output;
}

function utf8_encode (string) 
{
	string = string.replace(/\r\n/g,"\n");
	var utftext = "";
	
	for (var n = 0; n < string.length; n++) 
	{
		var c = string.charCodeAt(n);
		if (c < 128) 
		{
			utftext += String.fromCharCode(c);
		}
		else if((c > 127) && (c < 2048)) 
		{
			utftext += String.fromCharCode((c >> 6) | 192);
			utftext += String.fromCharCode((c & 63) | 128);
		}
		else
		{
			utftext += String.fromCharCode((c >> 12) | 224);
			utftext += String.fromCharCode(((c >> 6) & 63) | 128);
			utftext += String.fromCharCode((c & 63) | 128);
		}
	}	
	return utftext;
}

function PCWin(event)
{
	if (event.keyCode == 13)
	{
		PCSubWin();
	}
}

function PCSubWin()
{	
	if (isLocked == true)
	{
		return ;
	}
		
	var auth;
	var password = $("pcPassword").value;
	var userName = $("userName").value;
	auth = "Basic "+Base64Encoding(userName+":"+password);
	document.cookie = "Authorization=" + auth;
	window.location.reload();
}

function deleteCookie(name) 
{ 
    var LargeExpDate = new Date ();
    document.cookie = name + "=; expires=" +LargeExpDate.toGMTString(); 
}

function $(id)
{
	return document.getElementById(id);
}

function lockWeb(bLock)
{
	$("userName").disabled = bLock;
	$("pcPassword").disabled = bLock;
}

function resize()
{
	bodyObj = document.body;
	bodyObj.style["width"] = (document.documentElement.clientWidth < 1000 ? 1000 : document.documentElement.clientWidth) + "px";
}

function pageLoad()
{
	resize();
	window.onresize = resize;
	window.setInterval("document.getElementById('iRefresh').src='/img/top_bg.jpg?' + (+new Date())", 500000); 
	var tip = $("tip"), tipStr="", note = $("note");
	var unLi = $("unLi");
	var pwLi = $("pwLi");
	var userName = $("userName");
	var pcPassword = $("pcPassword");
	
	deleteCookie("Authorization");
	
	pcPassword.onfocus = function()
	{
		pwLi.style.background = "url(../img/login/pwselect.png)";
	};
	
	pcPassword.onblur = function()
	{
		pwLi.style.background = "url(../img/login/pwunselect.png)";
	};
	   
	userName.onfocus = function()
	{
		unLi.style.background = "url(../img/login/idselect.png)";
	};
	   
	userName.onblur = function()
	{
		unLi.style.background = "url(../img/login/idunselect.png)";
	};
	
	try { 
		if (modelName) 
		{
			document.title = modelName; 
			$("mnum").innerHTML = "Model No. " + modelName;		
		} 
		if(modelDesc)
		{
			$("mname").innerHTML = modelDesc;
		}
	}catch(e) {}
	
	if (authTimes > 0)
	{
		$("note").innerHTML = "NOTE:";
		$("tip").innerHTML = "The username or password is incorrect, please try again.";
	}	
	
	if (authTimes >= 5)
	{
		isLocked = true;
		lockWeb(true);
		$("note").innerHTML = "NOTE:";
		tipStr = "You have exceeded five login attempts. Please try again in ";
		count = 600 - forbidTime;
		$("tip").innerHTML = tipStr + count + "s.";		
		window.setTimeout(function()
		{
			if (count < 1)
			{
				$("note").innerHTML = "";
				$("tip").innerHTML = "";
				isLocked = false;
				lockWeb(false);
				userName.focus();
				deleteCookie("Authorization");
				window.location.reload();
				return ;
			}
			count--;
			$("tip").innerHTML = tipStr + count + "s.";
			window.setTimeout(arguments.callee, 1000);
		}, 1000);
	}
	else
	{
		userName.focus();
	}
}
</script>
</head>

<body onkeypress="PCWin(event)" onload="pageLoad()">
<div  style="height: 90px; background: #09C url(../img/login/top_bg.jpg) repeat-x;">
	<a href="http://www.tp-link.com"><img id="logo" src="../img/login/top1_1.jpg" style="float: left;" border="0" /></a>
	<div id="mod" style="height: 87px; margin: 0; text-align: right; overflow: hidden; background: url(../img/login/top1_2.jpg) no-repeat right;" >
	<p id="mname" style="font-size: 16px; font-weight: bold; color: #fff; margin: 37px 24px 0 0; padding: 0;"></p>
	<p id="mnum" style="font-size: 12px; font-weight: bold; color: #fff; margin: 2px 24px 0 0; padding: 0;"></p>
	</div>
	<img id="bhr" src="../img/login/top2.jpg" style="height: 3px; width: 100%; display: block;" />
</div>
<div class="loginBox">
	<div class="noteDiv">
		<span id="note"></span>
		<span id="tip"></span>
	</div>
	<div class="panelThre" align="center">
		<div class="picDiv">
			<ul>
				<li id="unLi" class="unLi"><input class="text" id="userName" type="input" maxlength="15" autocomplete="off"/></li>
				<li class="blank"></li>
				<li id="pwLi" class="pwLi"><input class="text" id="pcPassword" type="password" maxlength="15" autocomplete="off"/></li>
			</ul>			
			<button id="loginBtn" class="loginBtn" onclick="PCSubWin()"/></button>
			<div>
				<label id="copyright">Copyright &copy; 2014 TP-LINK Technologies Co., Ltd. All rights reserved. </label>
			</div>
		</div>
	</div>
</div>
<iframe src="../img/top_bg.jpg" width="0" height="0" frameBorder=0 id="iRefresh"></iframe> 
</body>
</html><script type="text/javascript"> var authTimes=0; var forbidTime=0; var modelName="Archer D7"; var modelDesc="AC1750 Wireless Dual Band Gigabit ADSL2+ Modem Router"</script>


Thanks

Hi everyone, Is there any way to force Firefox to save username password of a site that refuses? I have tried the JavaScript bookmarklets in this page but they do not work. http://kb.mozillazine.org/User_name_and_password_not_remembered The page in question is from a TP Link Modem Router Archer D7. Following is the source code of the login page. <pre><nowiki><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <META http-equiv=Content-Type content="text/html; charset=utf-8" /> <META http-equiv=Pragma content=no-cache> <META http-equiv=Expires content=0> <style type="text/css"> body { font-family:Arial, sans-serief; background-color:#E5E5E5; margin:0px; padding:0px; } div.loginBox { display: block; position:relative; margin-top:10%; text-align:center; } .noteDiv { color:gray; font-family:Arial; width:395px; text-align:left; margin:0px auto; font-size:14px; } #note { display:inline-block; vertical-align:top; _display:inline; _zoom:1; width:50px; font-weight:bold; } #tip { display:inline-block; vertical-align:top; _display:inline; _zoom:1; width:340px; } div.panelThre { margin-top:10px; } div.picDiv { width:395px; height:276px; background:url(../img/login/bg2.png); position:relative; } input.pcPassword { width:300px; height:50px; line-height:50px; padding-left:20px; } ul { padding:60px 0px 0px 0px; margin:0px; list-style:none; } ul li { height:34px; width:222px; } li.unLi { background:url(../img/login/idunselect.png); } li.pwLi { background:url(../img/login/pwunselect.png); } li.blank { height:15px; } button.loginBtn { border:none; height:34px; display:inline-block; width:113px; margin-top:30px; background:url(../img/login/login.png); cursor:pointer; } input.text { border:0px; height:26px; line-height:26px; width:175px; padding:0px; margin:4px 0px 0px 30px; font-size:14px; color:#6a6969; font-family:"Verdana","Arial"; outline: none; } #copyright { -webkit-text-size-adjust:none; font-size:9px; color:#6a6969; font-family:"Verdana"; margin-top:40px; display:inline-block; } </style> <script type="text/javascript"> var isLocked = false; function Base64Encoding(input) { var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); } return output; } function utf8_encode (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } function PCWin(event) { if (event.keyCode == 13) { PCSubWin(); } } function PCSubWin() { if (isLocked == true) { return ; } var auth; var password = $("pcPassword").value; var userName = $("userName").value; auth = "Basic "+Base64Encoding(userName+":"+password); document.cookie = "Authorization=" + auth; window.location.reload(); } function deleteCookie(name) { var LargeExpDate = new Date (); document.cookie = name + "=; expires=" +LargeExpDate.toGMTString(); } function $(id) { return document.getElementById(id); } function lockWeb(bLock) { $("userName").disabled = bLock; $("pcPassword").disabled = bLock; } function resize() { bodyObj = document.body; bodyObj.style["width"] = (document.documentElement.clientWidth < 1000 ? 1000 : document.documentElement.clientWidth) + "px"; } function pageLoad() { resize(); window.onresize = resize; window.setInterval("document.getElementById('iRefresh').src='/img/top_bg.jpg?' + (+new Date())", 500000); var tip = $("tip"), tipStr="", note = $("note"); var unLi = $("unLi"); var pwLi = $("pwLi"); var userName = $("userName"); var pcPassword = $("pcPassword"); deleteCookie("Authorization"); pcPassword.onfocus = function() { pwLi.style.background = "url(../img/login/pwselect.png)"; }; pcPassword.onblur = function() { pwLi.style.background = "url(../img/login/pwunselect.png)"; }; userName.onfocus = function() { unLi.style.background = "url(../img/login/idselect.png)"; }; userName.onblur = function() { unLi.style.background = "url(../img/login/idunselect.png)"; }; try { if (modelName) { document.title = modelName; $("mnum").innerHTML = "Model No. " + modelName; } if(modelDesc) { $("mname").innerHTML = modelDesc; } }catch(e) {} if (authTimes > 0) { $("note").innerHTML = "NOTE:"; $("tip").innerHTML = "The username or password is incorrect, please try again."; } if (authTimes >= 5) { isLocked = true; lockWeb(true); $("note").innerHTML = "NOTE:"; tipStr = "You have exceeded five login attempts. Please try again in "; count = 600 - forbidTime; $("tip").innerHTML = tipStr + count + "s."; window.setTimeout(function() { if (count < 1) { $("note").innerHTML = ""; $("tip").innerHTML = ""; isLocked = false; lockWeb(false); userName.focus(); deleteCookie("Authorization"); window.location.reload(); return ; } count--; $("tip").innerHTML = tipStr + count + "s."; window.setTimeout(arguments.callee, 1000); }, 1000); } else { userName.focus(); } } </script> </head> <body onkeypress="PCWin(event)" onload="pageLoad()"> <div style="height: 90px; background: #09C url(../img/login/top_bg.jpg) repeat-x;"> <a href="http://www.tp-link.com"><img id="logo" src="../img/login/top1_1.jpg" style="float: left;" border="0" /></a> <div id="mod" style="height: 87px; margin: 0; text-align: right; overflow: hidden; background: url(../img/login/top1_2.jpg) no-repeat right;" > <p id="mname" style="font-size: 16px; font-weight: bold; color: #fff; margin: 37px 24px 0 0; padding: 0;"></p> <p id="mnum" style="font-size: 12px; font-weight: bold; color: #fff; margin: 2px 24px 0 0; padding: 0;"></p> </div> <img id="bhr" src="../img/login/top2.jpg" style="height: 3px; width: 100%; display: block;" /> </div> <div class="loginBox"> <div class="noteDiv"> <span id="note"></span> <span id="tip"></span> </div> <div class="panelThre" align="center"> <div class="picDiv"> <ul> <li id="unLi" class="unLi"><input class="text" id="userName" type="input" maxlength="15" autocomplete="off"/></li> <li class="blank"></li> <li id="pwLi" class="pwLi"><input class="text" id="pcPassword" type="password" maxlength="15" autocomplete="off"/></li> </ul> <button id="loginBtn" class="loginBtn" onclick="PCSubWin()"/></button> <div> <label id="copyright">Copyright &copy; 2014 TP-LINK Technologies Co., Ltd. All rights reserved. </label> </div> </div> </div> </div> <iframe src="../img/top_bg.jpg" width="0" height="0" frameBorder=0 id="iRefresh"></iframe> </body> </html><script type="text/javascript"> var authTimes=0; var forbidTime=0; var modelName="Archer D7"; var modelDesc="AC1750 Wireless Dual Band Gigabit ADSL2+ Modem Router"</script> </nowiki></pre> Thanks

Ndryshuar nga cor-el

Zgjidhje e zgjedhur

I played around with the inspector a little bit and figured out the damn thing!

Here it is the javascript bookmarklet solution for posterity:

javascript:{document.getElementById('userName').value="admin";document.getElementById('pcPassword').value="blahblah";document.getElementById('loginBtn').click();void(0)}


TO TP LINK MAKERS: Why did you have to make this stupid design decision?!

Lexojeni këtë përgjigje brenda kontekstit 👍 2

Krejt Përgjigjet (8)

more options

I had the same problem and filed a bug report. https://bugzilla.mozilla.org/show_bug.cgi?id=1051332

What you can do is use a form filling add-on. The one I use works. Some web sites tell Firefox not to auto-fill. But the form fillers still work.

Go to the Mozilla Add-ons Web Page {web link} (There’s a lot of good stuff here) and search for what you want.

more options

This is a fairly common design decision by sites:

<input class="text" id="userName" type="input" maxlength="15" autocomplete="off"/>
<input class="text" id="pcPassword" type="password" maxlength="15" autocomplete="off"/>

If you try to call up the autocomplete drop-down in the field by pressing the down arrow on the keyboard, or typing the first character and pressing the down arrow, does it show?

more options

Do you mean that Firefox doesn't offer to save the name and password in the Password Manager and show a key icon on the location/address bar?

Current Firefox versions should be able to ave the name and password even in case like yours when autocomplete=off is present in the input fields. Firefox won't auto-fill the name and password in such a case though.

more options

Save Password is not offered by Firefox at all, neither when I enter my username and password and submit, nor after the login goes through and the next page loads. Also when I revisit the page, there is no way to open the drop down autocomplete menu. (tried down arrow key, and entering the first letter of username)

when I used the force save JavaScript bookmarklet the output said:

Removed autocomplete=off from: 0 forms 0 form elements

Removed onsubmit from: 0 forms

I would really like to know how to force save using Firefox only and not with additional Addons.

Attached is screenshot of the login page for reference.

Thanks

Ndryshuar nga FAnDwyHSHoo2K

more options

The bookmarklet might not work if frames are involved.

You can always right-click an input field and open the Inspector via Inspect Element and check if there is an autocomplete="off" attribute present.

more options

correct. the bookmarklet is not picking up the autocomplete in this case. but when I right click anywhere in the page, I do not see any mention of iFrame.

any way to force save on this bad boy?

Ndryshuar nga FAnDwyHSHoo2K

more options

There is no form on that page, only two input fields and a submit button and the bookmarklet only works with a form. I'm not sure how and if the Firefox Password Manager works in this case.


javascript:(function(){var I,N=document.querySelectorAll('form[autocomplete],input[autocomplete]'),i,j=0;for(i=0;I=N[i];i++){if(I.getAttribute('autocomplete')=='off'){I.setAttribute('autocomplete','on');alert('['+(++j)+'] '+I.nodeName+': '+(I.name||I.id))}}})()

Ndryshuar nga cor-el

more options

Zgjidhja e Zgjedhur

I played around with the inspector a little bit and figured out the damn thing!

Here it is the javascript bookmarklet solution for posterity:

javascript:{document.getElementById('userName').value="admin";document.getElementById('pcPassword').value="blahblah";document.getElementById('loginBtn').click();void(0)}


TO TP LINK MAKERS: Why did you have to make this stupid design decision?!

Ndryshuar nga FAnDwyHSHoo2K