473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Autofill user name and password

Hello,

I have a situation where I have to share user names and passwords for a list of sites among several (30 or so) users. These passwords must be reset every 90 days and anytime any one of the users is no longer employed by us. As you can imagine, the user will get locked frequently due to people not paying attention to when a password changes.

I want to create a web site that has a link to each site that when clicked will take you to the site and auto fill the user name and password.

I am attempting to do this using bookmarklets. This is what I have so far:

Expand|Select|Wrap|Line Numbers
  1. javascript:window.location.href ="http://www.mysite.com";
  2. checkLoad();
  3.  
  4. function checkLoad()
  5. {
  6. if (window.onLoad)
  7. {document.forms[0].elements["oper"].value ='Eric';document.forms[0].elements["pswd"].value = 'secret';} 
  8. else {setTimeout('checkLoad()',1000);}}
Obviously, I replaced mysite.com with the site I was trying to log into.

I know the second bit works (the document.forms... part) because if I navigate to the page and then execute it, it will fill in the fields. However, when I run it as is, it takes me to the page but does not fill in the fields.

The function checkLoad is supposed to check if the page is loaded and fill in the fields when it is, but it isn't working. Any suggestions or alternative approaches would be very welcome
Dec 2 '09 #1
15 8460
Dormilich
8,658 Expert Mod 8TB
postpone the call until the page finished loading, meaning use the onload event.
Expand|Select|Wrap|Line Numbers
  1. window.onload = function() {
  2.     // execute code here
  3. }
  4. // or
  5. window.onload = fn_call;
Dec 2 '09 #2
I tried this:

Expand|Select|Wrap|Line Numbers
  1. javascript:window.location.href ="https://www.mysite.com";window.onload = document.forms[0].elements["oper"].value ='Eric';document.forms[0].elements["pswd"].value = 'secret';
No luck, it navigates to the page but does not fill out the fields. Any ideas as to why not?
Dec 2 '09 #3
Dormilich
8,658 Expert Mod 8TB
Any ideas as to why not?
sure, the syntax is wrong. every event handler ecpects a function to be passed.

Expand|Select|Wrap|Line Numbers
  1. function doSomething()
  2. {
  3.     // some code
  4. }
  5. window.onload = doSomething;
Dec 2 '09 #4
OK - I think I'm not getting it. Here's what I've got:

Expand|Select|Wrap|Line Numbers
  1. javascript:window.location.href ="https://mysite.com";
  2. window.onload = PreFill();
  3. function PreFill()
  4. {
  5. document.forms[0].elements["oper"].value ='Eric';
  6. document.forms[0].elements["pswd"].value = 'secret';
  7. }
  8.  
If I execute this from a different website, it will take me to the desired website but will not fill in the form.

If I execute it from the website I'm trying to go to, it will briefly fill out the name and password fields but then reload the site and remove the info from these fields. Its as if it is not waiting until the site is loaded to run the function PreFill().
Dec 2 '09 #5
Dormilich
8,658 Expert Mod 8TB
the syntax on line 2 is still incorrect, see example above.
Dec 2 '09 #6
Sorry, but I am still not getting what is wrong with line 2. I tried putting the function call after the function definition, like so:
Expand|Select|Wrap|Line Numbers
  1.  javascript:window.location.href ="https://mysite.com";
  2.  function PreFill()
  3.  {
  4.  document.forms[0].elements["oper"].value ='Eric';
  5.  document.forms[0].elements["pswd"].value = 'secret';
  6.  };
  7.  window.onload = PreFill();
  8.  
but got the same result - it would take me to the page but not prefill anything. I am running this like a bookmarklet - is that the problem? Is there another way I could run it?
Dec 2 '09 #7
Dormilich
8,658 Expert Mod 8TB
compare
Expand|Select|Wrap|Line Numbers
  1. window.onload = doSomething;
with
Expand|Select|Wrap|Line Numbers
  1. window.onload = PreFill();
what’s the difference?
Dec 2 '09 #8
The difference is the name of the function and the fact that I have parenthesis and you do not. When I remove the parenthesis, the same thing happens - the page opens, but the fields are not pre loaded. If I rename the function, that does not work either.
Dec 2 '09 #9
Dormilich
8,658 Expert Mod 8TB
anyways, putting the parentheses there is simply wrong (for a certain reason).

I’ll do some testing to reproduce the error.
Dec 2 '09 #10
Dormilich
8,658 Expert Mod 8TB
after following some links I found that the bookmarklets are treated like links, thus the use of the void() function seems favourable. further investigation to follow.

personally I doubt, that you can execute code after you load another page.

if I try to jump to another page and then execute code, I’m prompted with an XSS warning. no point in trying this approach further.

however, you may use the bookmarklet on your page after you load the page via regular bookmark. this certainly worked.
Dec 2 '09 #11
Thanks for your help on this so far.

If a bookmarklet won't work, do you have any other ideas as to how I can approach this? My goal is to have a page that would list all sites that we use a shared password for. When you clicked on the site, it would take you to the site and enter your credentials. Thanks again!
Dec 3 '09 #12
Dormilich
8,658 Expert Mod 8TB
When you clicked on the site, it would take you to the site and enter your credentials.
my browser handles those for me, no need to use anything else.
Dec 3 '09 #13
Yes, and that is part of the issue. Given that the credentials are shared among several users, and need to be changed every 90 days, we run into problems where the stored credentials become invalid. The user tries multiple times and ends up locking the account, which then needs to be unlocked.

The idea here is that if they used the link I want to create, they would always be using the correct credentials.
Dec 3 '09 #14
acoder
16,027 Expert Mod 8TB
One possibility is:
Expand|Select|Wrap|Line Numbers
  1. javascript:window.location.href ="https://www.mysite.com/index.html?oper=Eric&pswd=secret";
though you'd have to change the code in the page to take the input parameters and set the username/password.

However, I would advise that whenever the user names and passwords are changed, display a message on the login page to inform the user that the password has changed, so they will know that they need to enter a new password.

Of course, users don't always follow instructions, so one more thing you could look at is to store the old password too, then if that is entered, post a friendly reminder that the password has now changed.

Just some ideas you could look into.
Dec 7 '09 #15
DMsy2
15
How about having the browser store the all passwords to autofill like normal and then re-writing the browser's datafile with external software to change the passwords?

If it's FireFox you may even be able to just get it to output a text file that you can change and email to all the user's to install?

How do you change the passwords on the many sites?
Dec 8 '09 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ross Lewis | last post by:
Is it possible to autofill a specific field in and Internet Explorer form. I would like to install a program on a client's computer that will automatically fill in a password field with their mac...
0
by: Chris Sharman | last post by:
I'd like to design my pages to work cooperatively with browser autofill features. I've loked around, but can't find any good documentation on supported/unsupported field names...
1
by: shortbackandsides.no | last post by:
I'm having a lot of difficulty trying to persuade the Google toolbar autofill to act consistently, for example ======================= <html><head> <title>autofill test</title> </head><body>...
0
by: David Portabella | last post by:
Hello, I am a doing a survey about Autofill Web Forms softwares. Usually, they all collect information of the user once during the set-up phase (user knowledge base). Then, when the user...
3
by: Anks | last post by:
Hi All, A user can control the AutoFill option by enabling / disabling the Remember Passwords option in Options - Privacy - Saved Passwords section. But is it possible to disable this option...
1
by: Nick J | last post by:
Hi, I remember at one point access would autofill a text box when filtering by form, Like for example as I would type it would come up with matching records, similar to AutoComplete in Internet...
4
by: Morten Wennevik | last post by:
I have a login.aspx page consisting of a username label and textbox, password label and textbox and a submit button. I want to programmatically autofill this and post it back. I am using the...
2
by: Andre Ranieri | last post by:
I'm retouching our corporate web site that, among other things, allows customers to log in and pay their invoices online. I noticed that on the checkout page, the credit card number textbox...
0
by: Randy | last post by:
Hi, I have some comboboxes that are created dynamically at run time based on user actions. I found a procedure on a message board to autofill the combobox text from the dataview that the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.